mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix major issue with threaded worker keepalive
The keepalive queue management is fixed to not pop extra connections incorrectly. Close #816
This commit is contained in:
parent
f310b04f48
commit
ec62d487f7
@ -134,18 +134,17 @@ class ThreadWorker(base.Worker):
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
# remove the connection from the queue
|
||||||
conn = self._keep.popleft()
|
conn = self._keep.popleft()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
break
|
break
|
||||||
|
|
||||||
delta = conn.timeout - now
|
delta = conn.timeout - now
|
||||||
if delta > 0:
|
if delta > 0:
|
||||||
|
# add the connection back to the queue
|
||||||
self._keep.appendleft(conn)
|
self._keep.appendleft(conn)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# remove the connection from the queue
|
|
||||||
conn = self._keep.popleft()
|
|
||||||
|
|
||||||
# remove the socket from the poller
|
# remove the socket from the poller
|
||||||
self.poller.unregister(conn.sock)
|
self.poller.unregister(conn.sock)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user