Fix asyncio.Event race conditions in idle processors
Move event.clear() from finally block to success path in IdleFrameProcessor and UserIdleProcessor._idle_task_handler(). The finally block unconditionally cleared signals set during async timeout callbacks, causing false-positive idle detection. Closes #3402
This commit is contained in:
committed by
Aleix Conchillo Flaqué
parent
988c08a5b6
commit
565349d332
@@ -85,7 +85,6 @@ class IdleFrameProcessor(FrameProcessor):
|
||||
while True:
|
||||
try:
|
||||
await asyncio.wait_for(self._idle_event.wait(), timeout=self._timeout)
|
||||
self._idle_event.clear()
|
||||
except asyncio.TimeoutError:
|
||||
await self._callback(self)
|
||||
finally:
|
||||
self._idle_event.clear()
|
||||
|
||||
Reference in New Issue
Block a user