-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
currently, each binary uses a different method for starting up its different components; some do this all in main.rs and others in a command, and the shutdown and task handle stopping is handled differently. the binaries should all have a similar structure for task startup and shutdown.
Proposed Solution
startup:
- every binary should have one entrypoint (eg.
Worker,Validator) which is the only thing exposed from the library part of the crate.main.rsshould then spawnworker.run()for example to start the service. therun()function will consumeselfand spawn all the different components necessary, run them in a select loop, and handle cancellation signals
shutdown:
run()should only return upon a critical error which the service cannot recover from. otherwise, errors should be logged or handled some other way.- if
run()returns, or if a cancellation signal is received, shutdown should be initiated by signaling all spawned tasks and waiting for them to complete in some amount of time (30s). if they don't finish by this time, they can be aborted.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request