Add fall back for Windows even loop fetching (#2421)
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = "22.3.0"
|
||||
__version__ = "22.3.1"
|
||||
|
||||
@@ -252,7 +252,13 @@ class Sanic(BaseSanic, RunnerMixin, metaclass=TouchUpMeta):
|
||||
"Loop can only be retrieved after the app has started "
|
||||
"running. Not supported with `create_server` function"
|
||||
)
|
||||
return get_running_loop()
|
||||
try:
|
||||
return get_running_loop()
|
||||
except RuntimeError:
|
||||
if sys.version_info > (3, 10):
|
||||
return asyncio.get_event_loop_policy().get_event_loop()
|
||||
else:
|
||||
return asyncio.get_event_loop()
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
# Registration
|
||||
|
||||
@@ -72,7 +72,7 @@ def ctrlc_workaround_for_windows(app):
|
||||
"""Asyncio wakeups to allow receiving SIGINT in Python"""
|
||||
while not die:
|
||||
# If someone else stopped the app, just exit
|
||||
if app.is_stopping:
|
||||
if app.state.is_stopping:
|
||||
return
|
||||
# Windows Python blocks signal handlers while the event loop is
|
||||
# waiting for I/O. Frequent wakeups keep interrupts flowing.
|
||||
|
||||
Reference in New Issue
Block a user