Skip to content

Commit 63eeb44

Browse files
committed
test: redis oplock
1 parent 2320246 commit 63eeb44

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/units/test_app.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,9 +1341,12 @@ async def _drain_background_tasks(app: App):
13411341
The gathered background task results.
13421342
"""
13431343
tasks = tuple(app._background_tasks)
1344-
if tasks:
1345-
return await asyncio.gather(*tasks, return_exceptions=True)
1346-
return []
1344+
results = await asyncio.gather(*tasks, return_exceptions=True) if tasks else []
1345+
if environment.REFLEX_OPLOCK_ENABLED.get():
1346+
# Redis oplocks can keep completed background-task writes in the local
1347+
# lease cache until the manager is closed.
1348+
await app.state_manager.close()
1349+
return results
13471350

13481351

13491352
@pytest.mark.asyncio

0 commit comments

Comments
 (0)