INNER CODE UNIT · Python

scan

caipe-io/ai-platform-engineering · ai_platform_engineering/audit_service/main.py:64

    def scan() -> QueryResult:
        try:
            return store.query(query)
        finally:
            # Cancelling an asyncio waiter cannot stop its thread. Capacity is
            # available only after the underlying storage scan actually exits.
            slots.release()

    task = asyncio.create_task(asyncio.to_thread(scan))
    task.add_done_callback(_log_query_failure)
    deadline = asyncio.get_running_loop().time() + timeout_seconds
    try:
        while True:
            done, _ = await asyncio.wait({task}, timeout=0.1)
            if done:
                return task.result()
            if await request.is_disconnected():
                raise HTTPException(status_code=499, detail="audit read client disconnected")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…