Skip to content

Commit 2dd4011

Browse files
committed
test
1 parent 0903526 commit 2dd4011

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,16 @@ async def main():
193193
# Set the stop condition when receiving SIGTERM.
194194
loop = asyncio.get_running_loop()
195195
stop = loop.create_future()
196-
loop.add_signal_handler(signal.SIGTERM, stop.set_result, None)
196+
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)
197206

198207
port = int(os.environ.get("PORT", "8001"))
199208
async with serve(handler, "", port, process_request=health_check):

0 commit comments

Comments
 (0)