refactor(worker): Rework qworker teardown#299
Open
ketiltrout wants to merge 1 commit into
Open
Conversation
Fixes for both normal and abnormal termination of the qworker process: * the worker will now always print exceptions that kill it * the worker _won't_ try to kill Sanic if it was Sanic that killed _it_. * SIGINT and SIGTERM properly handled * Redis connection cleanly closed before exit Also: * Moved the giant `go` function out of the function it was embedded in for better code legibility.
tristpinsm
approved these changes
Jul 17, 2026
tristpinsm
left a comment
Contributor
There was a problem hiding this comment.
I did my best to work through the exit paths and I think it all makes sense!
|
|
||
| # Normal exceptions should be supressed, BaseExceptions (e.g. | ||
| # KeyboardInterrupt) should be re-raised | ||
| if not isinstance(e, Exception): |
Contributor
There was a problem hiding this comment.
it's not hurting anything, but I think this block is unreachable. If e was a BaseException, it would never make it here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for both normal and abnormal termination of the qworker process:
Also:
gofunction out of the function it was embedded in for better code legibility. (There are no code changes in thegofunction.)I think this may be at least partially responsible for some of the spurious test failures in the CI