From 1580ca637fca3905d02dcf45a0c66dc76e321c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Fri, 20 Mar 2020 17:42:28 +0200 Subject: [PATCH] Improved comments. --- sanic/compat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sanic/compat.py b/sanic/compat.py index c70b50d7..fc747c46 100644 --- a/sanic/compat.py +++ b/sanic/compat.py @@ -30,12 +30,14 @@ else: def ctrlc_workaround_for_windows(app): async def stay_active(app): - """Frequently poll asyncio to allow *receiving* any signals in Python""" + """Asyncio wakeups to allow receiving SIGINT in Python""" loop = asyncio.get_running_loop() while not die: # If someone else stopped the app, just exit if getattr(loop, "_stopping", False): return + # Windows Python blocks signal handlers while the event loop is + # waiting for I/O. Frequent wakeups keep interrupts flowing. await asyncio.sleep(0.1) # Can't be called from signal handler, so call it from here app.stop()