mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #1967 from skytoup/master
Fix #1965: About gunicorn [CRITICAL] Worker Timeout
This commit is contained in:
commit
b5d78e8bc7
@ -495,7 +495,7 @@ class Arbiter(object):
|
|||||||
workers = list(self.WORKERS.items())
|
workers = list(self.WORKERS.items())
|
||||||
for (pid, worker) in workers:
|
for (pid, worker) in workers:
|
||||||
try:
|
try:
|
||||||
if time.time() - worker.tmp.last_update() <= self.timeout:
|
if time.monotonic() - worker.tmp.last_update() <= self.timeout:
|
||||||
continue
|
continue
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import platform
|
import platform
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -40,10 +41,11 @@ class WorkerTmp(object):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def notify(self):
|
def notify(self):
|
||||||
os.utime(self._tmp.fileno())
|
new_time = time.monotonic()
|
||||||
|
os.utime(self._tmp.fileno(), (new_time, new_time))
|
||||||
|
|
||||||
def last_update(self):
|
def last_update(self):
|
||||||
return os.fstat(self._tmp.fileno()).st_ctime
|
return os.fstat(self._tmp.fileno()).st_mtime
|
||||||
|
|
||||||
def fileno(self):
|
def fileno(self):
|
||||||
return self._tmp.fileno()
|
return self._tmp.fileno()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user