Skip to content

Commit acc8225

Browse files
committed
simplify AppHarness song and dance for flushing backend's StateManagerDisk
1 parent 51c8207 commit acc8225

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

reflex/testing.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -729,16 +729,7 @@ async def get_state(self, token: str) -> BaseState:
729729
):
730730
# Song and dance to convince the instance's state manager to flush
731731
# (we can't directly await the _other_ loop's Future)
732-
og_write_queue_task = self.app_instance.state_manager._write_queue_task
733-
self.app_instance.state_manager._write_queue_task = None
734-
while self.app_instance.state_manager._write_queue:
735-
await self.app_instance.state_manager._schedule_process_write_queue()
736-
assert (
737-
self.app_instance.state_manager._write_queue_task
738-
is not og_write_queue_task
739-
)
740-
await self.app_instance.state_manager.close()
741-
self.app_instance.state_manager._write_queue_task = og_write_queue_task
732+
await self.app_instance.state_manager._flush_write_queue()
742733
if isinstance(self.state_manager, StateManagerDisk):
743734
# Force reload the latest state from disk.
744735
client_token, _ = _split_substate_key(token)

0 commit comments

Comments
 (0)