shutter-network / rolling-shutter

Rolling Shutter is an MEV protection system to be plugged into rollups.
https://twitter.com/project_shutter/
26 stars 7 forks source link

Graceful shutdown on service errors #405

Closed ezdac closed 10 months ago

ezdac commented 10 months ago

Before, we omitted polling for upstream context ctx.Done() sends in some services. The errorgroup of the overall service will send ctx.Done() whenever there is an error in the spawned routines. However all other routines have to manually make sure they react on this signal.

Now, all goroutines spawned from services implement this graceful shutdown. In some implementations, there is quite some async / long running code between checks for new context signals. This could be optimised in the future.

The correct shutdown of all goroutines has the effect that the error that caused that shutdown will now bubble up until the main invocation of the command. The resulting error is now printed to stderr.