mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix #1965: About gunicorn [CRITICAL] Worker Timeout
This commit is contained in:
parent
7af6f651c0
commit
54d35d7358
@ -494,7 +494,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
|
||||
|
||||
@ -35,14 +36,12 @@ class WorkerTmp(object):
|
||||
os.close(fd)
|
||||
raise
|
||||
|
||||
self.spinner = 0
|
||||
|
||||
def notify(self):
|
||||
self.spinner = (self.spinner + 1) % 2
|
||||
os.fchmod(self._tmp.fileno(), self.spinner)
|
||||
new_time = time.monotonic()
|
||||
os.utime(self._tmp.name, (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