mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Clear tornado ioloop before os.fork (#1831)
This commit is contained in:
parent
7d0787cd1a
commit
cdd147841a
@ -69,6 +69,14 @@ class TornadoWorker(Worker):
|
|||||||
if not self.ioloop._callbacks:
|
if not self.ioloop._callbacks:
|
||||||
self.ioloop.stop()
|
self.ioloop.stop()
|
||||||
|
|
||||||
|
def init_process(self):
|
||||||
|
# IOLoop cannot survive a fork or be shared across processes
|
||||||
|
# in any way. When multiple processes are being used, each process
|
||||||
|
# should create its own IOLoop. We should clear current IOLoop
|
||||||
|
# if exists before os.fork.
|
||||||
|
IOLoop.clear_current()
|
||||||
|
super(TornadoWorker, self).init_process()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ioloop = IOLoop.instance()
|
self.ioloop = IOLoop.instance()
|
||||||
self.alive = True
|
self.alive = True
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user