We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0903526 commit 2dd4011Copy full SHA for 2dd4011
app.py
@@ -193,7 +193,16 @@ async def main():
193
# Set the stop condition when receiving SIGTERM.
194
loop = asyncio.get_running_loop()
195
stop = loop.create_future()
196
- loop.add_signal_handler(signal.SIGTERM, stop.set_result, None)
+
197
+ def sig_handler():
198
+ print(stop._state)
199
+ try:
200
+ stop.set_result(None)
201
+ except Exception as exc:
202
+ print(exc)
203
204
205
+ loop.add_signal_handler(signal.SIGTERM, sig_handler)
206
207
port = int(os.environ.get("PORT", "8001"))
208
async with serve(handler, "", port, process_request=health_check):
0 commit comments