Skip to content

Provide a mechanism to reload the indexer while it's running #187

@fracek

Description

@fracek

Some users need to periodically reload their indexer while it's running. Their use case is that the events they want to listen to depend on values from an external API.

User facing changes

I propose adding a new reloadIndexer() helper that signals to the runner to reload and restart the indexer.

Implementation

The helper function should simply throw a special error (ReloadIndexerRequest) that the outside components of the code can catch and handle:

  • stop the existing indexer.
  • reload the config (e.g. any call to getRuntimeDataFromEnv())
  • create a new indexer's instance
  • run the new instance

I believe we need to change both the dev and start command.

Testing

We should ensure that calling this function results in the indexer's constructor being called. We should also ensure that in dev mode only the indexer that requested the restart is restarted.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions