MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / consumer

Method consumer

test/asynchronous/test_locks.py:374–381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

372 state = 0
373
374 async def consumer():
375 nonlocal state
376 async with condition:
377 while True:
378 await condition.wait_for(lambda: state != 0)
379 if state < 0:
380 return
381 state -= 1
382
383 # create two consumers
384 c = [asyncio.create_task(consumer()) for _ in range(2)]

Callers

nothing calls this directly

Calls 1

wait_forMethod · 0.80

Tested by

no test coverage detected