mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
gthread: improve accepting connections loop
make sure we stop accepting immediately when max connections is achieved.
This commit is contained in:
parent
048dcf410c
commit
cfc6dc778e
@ -102,6 +102,9 @@ class ThreadWorker(base.Worker):
|
|||||||
super(ThreadWorker, self).init_process()
|
super(ThreadWorker, self).init_process()
|
||||||
|
|
||||||
def accept(self, listener):
|
def accept(self, listener):
|
||||||
|
if not self.alive:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client, addr = listener.accept()
|
client, addr = listener.accept()
|
||||||
conn = TConn(self.cfg, listener, client, addr)
|
conn = TConn(self.cfg, listener, client, addr)
|
||||||
@ -174,6 +177,7 @@ class ThreadWorker(base.Worker):
|
|||||||
if len(self.futures) >= self.worker_connections:
|
if len(self.futures) >= self.worker_connections:
|
||||||
res = futures.wait(self.futures, timeout=timeout)
|
res = futures.wait(self.futures, timeout=timeout)
|
||||||
if not res:
|
if not res:
|
||||||
|
self.alive = False
|
||||||
self.log.info("max requests achieved")
|
self.log.info("max requests achieved")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user