Merge pull request #719 from messense/feature/worker-uvloop
Gunicorn worker should not require uvloop
This commit is contained in:
commit
5c44ce1637
|
@ -9,7 +9,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
ssl = None
|
ssl = None
|
||||||
|
|
||||||
|
try:
|
||||||
import uvloop
|
import uvloop
|
||||||
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
import gunicorn.workers.base as base
|
import gunicorn.workers.base as base
|
||||||
|
|
||||||
from sanic.server import trigger_events, serve, HttpProtocol, Signal
|
from sanic.server import trigger_events, serve, HttpProtocol, Signal
|
||||||
|
@ -34,7 +38,6 @@ class GunicornWorker(base.Worker):
|
||||||
# create new event_loop after fork
|
# create new event_loop after fork
|
||||||
asyncio.get_event_loop().close()
|
asyncio.get_event_loop().close()
|
||||||
|
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
|
||||||
self.loop = asyncio.new_event_loop()
|
self.loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(self.loop)
|
asyncio.set_event_loop(self.loop)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user