ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.65k stars 3.28k forks source link

Extend op-service LifecycleCmd usage to all long-running Go services #7671

Open protolambda opened 1 year ago

protolambda commented 1 year ago

Op-node uses cliapp.LifecycleCmd to handle startup/shutdown/force-shutdown, while ensuring resources are closed and any shutdown errors are propagated properly.

Previous context-based shutdown patterns encouraged bad code that shuts down like defer thing.Close() without propagating the error, or even returning before go-routines of the service fully shutdown, since context closure triggers shutdown, but does not await the results.

Services to update:

mslipper commented 12 months ago

@protolambda are you still working on this?

protolambda commented 12 months ago

@mslipper an external contributor implemented the op-proposer changes last week. op-batcher and op-node are already done. Op-challenger remains I think.

protolambda commented 12 months ago

The indexer is also done. And I think op-bootnode, op-heartbeat and op-wheel are nice to have; they work relatively well as-is since they don't have a lot of resources to start/close, but I may be able to implement the changes there soon now that I'm back from devconnect.