Drain sequential event tasks during shutdown#6791
Conversation
Greptile SummaryThis PR fixes a bug where same-token sequential events queued during graceful shutdown were cancelled instead of drained. The old
Confidence Score: 5/5Safe to merge — the change is tightly scoped to the shutdown drain loop and is backed by a direct regression test. The logic change is correct: asyncio done callbacks run synchronously when a task finishes, so self._tasks is already updated by the time each asyncio.wait call returns. The while loop therefore always works on a fresh snapshot, the deadline guard prevents infinite looping, and the if-not-finished-tasks break handles timeouts cleanly. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Add changelog for event processor shutdo..." | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
|
hey @FarhanAliRaza can you go through this |
Fixes #6755.
Summary
EventProcessor._stop_tasks()to keep draining tasks dispatched during graceful shutdown_finish_task()within the remaining shutdown budgetTests
uv run pytest tests/units/reflex_base/event/processor/test_event_processor.py -quv run ruff check packages/reflex-base/src/reflex_base/event/processor/event_processor.py tests/units/reflex_base/ event/processor/test_event_processor.pyuv run ruff format --check packages/reflex-base/src/reflex_base/event/processor/event_processor.py tests/units/ reflex_base/event/processor/test_event_processor.pyuv run pyright packages/reflex-base/src/reflex_base/event/processor/event_processor.py tests/units/reflex_base/ event/processor/test_event_processor.py