Skip to content

Commit

Permalink
Merge pull request #2288 from dekexu/master
Browse files Browse the repository at this point in the history
Upgrade gthread worker  when behind load balancer
  • Loading branch information
tilgovi authored Apr 20, 2020
2 parents ee685e1 + 0896392 commit 4591b51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gunicorn/workers/gthread.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def finish_request(self, fs):
(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)

Expand Down Expand Up @@ -307,7 +307,7 @@ def handle_request(self, req, conn):
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
Expand Down

0 comments on commit 4591b51

Please sign in to comment.