Skip to content

Commit

Permalink
Fix inverted shutdown logic in async service task (Fixes #354)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed May 18, 2024
1 parent 942da84 commit 8e688ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/engineio/async_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ async def _service_task(self): # pragma: no cover
try:
await asyncio.wait_for(self.service_task_event.wait(),
timeout=self.ping_timeout)
except asyncio.TimeoutError:
break
continue
except asyncio.TimeoutError:
continue

# go through the entire client list in a ping interval cycle
sleep_interval = self.ping_timeout / len(self.sockets)
Expand All @@ -546,8 +546,9 @@ async def _service_task(self): # pragma: no cover
try:
await asyncio.wait_for(self.service_task_event.wait(),
timeout=sleep_interval)
except asyncio.TimeoutError:
raise KeyboardInterrupt()
except asyncio.TimeoutError:
continue
except (
SystemExit,
KeyboardInterrupt,
Expand Down

0 comments on commit 8e688ba

Please sign in to comment.