fix(state): reset disk write queue task on close#6715
Conversation
Greptile SummaryThis PR fixes a one-line indentation bug in
Confidence Score: 5/5Safe to merge — the fix is a single-line dedent that moves an assignment to always execute after close(), and a regression test confirms the corrected behavior. The change is minimal and precise: one line moved out of a suppress block so it cannot be silently skipped by a re-raised CancelledError. The logic matches the existing pattern in StateManagerMemory.close(), and the added regression test directly validates the post-close state of _write_queue_task. No other behavior is altered. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(state): reset disk write queue task ..." | Re-trigger Greptile |
Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
|
Pushed a revision addressing the latest review/CI feedback. |
Summary
Reset
StateManagerDisk._write_queue_tasktoNoneafterclose()cancels andawaits the background write queue task.
The assignment was inside the
contextlib.suppress(asyncio.CancelledError)block,immediately after awaiting the cancelled task. Since the write queue task re-raises
CancelledErrorafter flushing pending writes, the suppressed exception skippedthe assignment and left
_write_queue_taskpointing at a cancelled task.This moves the reset outside the suppress block, matching the pattern already used
by
StateManagerMemory.close().Testing
uv run pytest tests/units/test_state.py::test_state_manager_disk_close_resets_write_queue_task -quv run pytest tests/units/test_state.py -quv run ruff check reflex/istate/manager/disk.py tests/units/test_state.pyuv run ruff format reflex/istate/manager/disk.py tests/units/test_state.py --checkuv run pyright reflex/istate/manager/disk.py tests/units/test_state.pyThe new regression test fails on the old indentation and passes with this change.