Skip to content

Commit b18f561

Browse files
test: rm redundant Barrier
Gathering 2 tasks is enough to test race condition
1 parent af1e19c commit b18f561

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

tests/unittests/tools/test_agent_tool_manager.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,13 @@ async def test_lock_prevents_race_condition(manager, agent):
241241
await manager.register_runner(agent, runner1)
242242
await manager.register_runner(agent, runner2)
243243

244-
# Create a barrier to synchronize unregistration attempts
245-
barrier = asyncio.Barrier(2)
246-
247-
async def unregister_with_barrier(runner):
248-
await barrier.wait() # Wait for both to reach this point
244+
async def unregister(runner):
249245
async with manager.unregister_runner(agent, runner) as should_cleanup:
250246
return should_cleanup
251247

252248
# Unregister both runners concurrently
253249
results = await asyncio.gather(
254-
unregister_with_barrier(runner1), unregister_with_barrier(runner2)
250+
unregister(runner1), unregister(runner2)
255251
)
256252

257253
# Exactly one should return True (the last one to complete)

0 commit comments

Comments
 (0)