INNER CODE UNIT · Python
wait_producers
ImFeH2/huddol · core/src/fora/adapters/websocket/server.py:237
def wait_producers(self) -> None:
with self.lock:
self.lock.wait_for(lambda: self.producers == 0)
async def worker[T](operation: Callable[..., T], *args: Any) -> T:
task = asyncio.create_task(asyncio.to_thread(operation, *args))
try:
return await asyncio.shield(task)
except asyncio.CancelledError:
await task
raise
@asynccontextmanager
async def resource[T](
operation: Callable[..., T],
release: Callable[[T], None],