optimism
optimism copied to clipboard
Use context interrupts consistently in more places
This was a fix that came out of fixing the shutdown handling when testing various services.
Mainly I made the signal use for interrupting contexts consistent, it was using different signals in different places, and not always using the interrupt waiter interface even though that was the intent.
There were a few places were unnecessary goroutines were spun out and cancellation was missed or not handled as intended. There's also a place where the context wasn't being used and a new cancellation method introduced to work around it, which wasn't the intent I think it was just missed in a refactor.
The rename from opio to ctxinterrupt seems a bit noisy but I think it conveys the intent better and removes some stutter around the naming.
This PR looks good to me altho I do not own a bunch of this code. The cannon diff is important to have somebody look at
I think the only pending question is whether the stdout punting is still wanted (someone might be expecting to see the "exiting..." message while using cannon. If so it would make sense to do that everytime an interrupt is received, probably by providing a small callback in cannon so that you only see the message on stdout if the signal is actually being handled by whoever is waiting on the interrupts.
Looks good. This is still stuck on a code owner 😬 @mslipper @zhwrd @0x00101010 ?
Thanks @zhwrd !