Skip to content

Commit

Permalink
Better handling of Gunicorn threaded worker
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Aug 21, 2023
1 parent 87f6003 commit 29e4492
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/engineio/async_drivers/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ def __init__(self, handler, server):

def __call__(self, environ, start_response):
self.ws = Server(environ)
return self.app(self)
ret = self.app(self)
if self.ws.mode == 'gunicorn':
raise StopIteration()
return ret

def close(self):
return self.ws.close()
if self.ws.connected:
self.ws.close()

def send(self, message):
try:
Expand Down

0 comments on commit 29e4492

Please sign in to comment.