mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
small tweak of 53c4484
since timeout patch affect only select call, it is better to not change self.timeout.
This commit is contained in:
parent
411ec544dc
commit
8270d43cc3
@ -26,11 +26,6 @@ class SyncWorker(base.Worker):
|
|||||||
for s in self.sockets:
|
for s in self.sockets:
|
||||||
s.setblocking(0)
|
s.setblocking(0)
|
||||||
|
|
||||||
if not self.timeout:
|
|
||||||
# if no timeout is given the worker will never wait and will
|
|
||||||
# use the CPU for nothing. This minimal timeout prevent it.
|
|
||||||
self.timeout = 0.5
|
|
||||||
|
|
||||||
ready = self.sockets
|
ready = self.sockets
|
||||||
while self.alive:
|
while self.alive:
|
||||||
self.notify()
|
self.notify()
|
||||||
@ -64,7 +59,12 @@ class SyncWorker(base.Worker):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.notify()
|
self.notify()
|
||||||
ret = select.select(self.sockets, [], self.PIPE, self.timeout)
|
|
||||||
|
# if no timeout is given the worker will never wait and will
|
||||||
|
# use the CPU for nothing. This minimal timeout prevent it.
|
||||||
|
timeout = self.timeout or 0.5
|
||||||
|
|
||||||
|
ret = select.select(self.sockets, [], self.PIPE, timeout)
|
||||||
if ret[0]:
|
if ret[0]:
|
||||||
ready = ret[0]
|
ready = ret[0]
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user