Replies: 1 comment 3 replies
-
@vokson is that a WSGI application? For ASGI you can rely on the lifespan events to perform actions on shutdown. Anyways, 1.4 will probably review signal handling and eventually add callbacks. In general, you can always customise what happens on the workers writing your own spawn method: for instance you can copy the code of |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Granian 1.3.1
My goal is to make program handling http request and send them to Kafka. I use
https://github.com/confluentinc/confluent-kafka-python
library, which is syncronious. Thus, I have to implement infinitive loop flushing kafka queue in separate thread for each granian's worker. The loop runs while flagis_cancelled = False
.When I stop program (Ctrl-C, for example),
I expect granian will stop and somehow move to shutdown_app() function to give me possibility to set
is_cancelled = True
and stop infinite thread. Unfortunately, granian never stops, because infinite thread is included in granian worker process.If changed to
proc.join(1)', after 1 sec execution moves ahead and comes in
shutdown_app` function, then I can manage other stuff.Possible solution:
Beta Was this translation helpful? Give feedback.
All reactions