Skip to content

Commit 8e688ba

Browse files
Fix inverted shutdown logic in async service task (Fixes #354)
1 parent 942da84 commit 8e688ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/engineio/async_server.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,9 @@ async def _service_task(self): # pragma: no cover
524524
try:
525525
await asyncio.wait_for(self.service_task_event.wait(),
526526
timeout=self.ping_timeout)
527-
except asyncio.TimeoutError:
528527
break
529-
continue
528+
except asyncio.TimeoutError:
529+
continue
530530

531531
# go through the entire client list in a ping interval cycle
532532
sleep_interval = self.ping_timeout / len(self.sockets)
@@ -546,8 +546,9 @@ async def _service_task(self): # pragma: no cover
546546
try:
547547
await asyncio.wait_for(self.service_task_event.wait(),
548548
timeout=sleep_interval)
549-
except asyncio.TimeoutError:
550549
raise KeyboardInterrupt()
550+
except asyncio.TimeoutError:
551+
continue
551552
except (
552553
SystemExit,
553554
KeyboardInterrupt,

0 commit comments

Comments
 (0)