About granian's behaviour when external interrupt such as keyboard interrupt is recieved #762
Unanswered
hermeschen1116
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have a question about how granian propagate interrupt to app, I have my fastapi lifespan function and server start function like below (factory function).
And I found when I successfully shutdown server by ctrl-c, the
except (KeyboardInterrupt, SystemExit, anyio.get_cancelled_exc_class()) as e:block is never entered. It directly goes to the finally block.Also there's an another problem is that if I start some background tasks inside startup_hook using anyio taskgroup, it always prevent server shutdown after finishing finally block and results to force kill behaviour. An example is like the code below.
And my environment is
I'm not sure if this is caused by how I handle the exception or something granian not support.
Beta Was this translation helpful? Give feedback.
All reactions