Merge pull request #1 from dekexu/dekexu-patch-1

Update gthread.py
This commit is contained in:
deco 2020-03-11 20:15:14 +08:00 committed by GitHub
commit 0896392e09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,7 +238,7 @@ class ThreadWorker(base.Worker):
(keepalive, conn) = fs.result()
# if the connection should be kept alived add it
# to the eventloop and record it
if keepalive:
if keepalive and self.alive:
# flag the socket as non blocked
conn.sock.setblocking(False)
@ -307,7 +307,7 @@ class ThreadWorker(base.Worker):
conn.server, self.cfg)
environ["wsgi.multithread"] = True
self.nr += 1
if self.alive and self.nr >= self.max_requests:
if self.nr >= self.max_requests:
self.log.info("Autorestarting worker after current request.")
resp.force_close()
self.alive = False