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())
|
||||
for (pid, worker) in workers:
|
||||
try:
|
||||
if time.time() - worker.tmp.last_update() <= self.timeout:
|
||||
if time.monotonic() - worker.tmp.last_update() <= self.timeout:
|
||||
continue
|
||||
except (OSError, ValueError):
|
||||
continue
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
# See the NOTICE for more information.
|
||||
|
||||
import os
|
||||
import time
|
||||
import platform
|
||||
import tempfile
|
||||
|
||||
@ -40,10 +41,11 @@ class WorkerTmp(object):
|
||||
raise
|
||||
|
||||
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):
|
||||
return os.fstat(self._tmp.fileno()).st_ctime
|
||||
return os.fstat(self._tmp.fileno()).st_mtime
|
||||
|
||||
def fileno(self):
|
||||
return self._tmp.fileno()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user