New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add loop helpers and simplify deploy example #46
Conversation
loop.set_debug(False) | ||
loop.create_task(run()) | ||
loop.run_forever() | ||
loop.run(main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be loop.run(main())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Yes it should.
e13c7c8
to
f71dcee
Compare
The interrupt handling doesn't work like I expected and we get a bunch of error dumps. Also now getting an error on normal run that I don't understand:
|
loop.set_debug(debug) | ||
if interruptable: | ||
for signame in ('SIGINT', 'SIGTERM'): | ||
loop.add_signal_handler(getattr(signal, signame), stop_loop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stop_loop
could be changed to loop.stop
I don't really understand the "signal handler must be callable" error either. Regarding errors at termination, I assume those are coming from still-running coroutines. You'll always get tracebacks if you stop the loop while any coroutines are still running. You can try canceling all running coroutines in your signal handler. |
f71dcee
to
2e973a3
Compare
@tvansteenburgh I tried cancelling the coroutines in various ways but couldn't avoid the errors, which is actually why I had the separate |
84cec83
to
b27c2c1
Compare
I got it working gracefully and (had to) boiled it down to a single helper function instead of split across three. |
LGTM, thanks @johnsca |
No description provided.