From c57252a9fc1bfbf46ad97a7615e7895316281a17 Mon Sep 17 00:00:00 2001 From: kuratowski Date: Wed, 6 Feb 2019 00:22:06 +0900 Subject: [PATCH] Modify code style --- daphne/testing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daphne/testing.py b/daphne/testing.py index bc71aab..5a61221 100644 --- a/daphne/testing.py +++ b/daphne/testing.py @@ -126,9 +126,11 @@ class DaphneProcess(multiprocessing.Process): # This is necessary because asyncio behaves badly with multiprocessing. from twisted.internet import asyncioreactor import sys + current_reactor = sys.modules.get("twisted.internet.reactor") if isinstance(current_reactor, asyncioreactor.AsyncioSelectorReactor): import asyncio + current_reactor._asyncioEventloop.close() asyncio.set_event_loop(asyncio.new_event_loop()) current_reactor._asyncioEventloop = asyncio.get_event_loop()