Blocking time.sleep() inside an async function
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.
What it detects
time.sleep() blocks the OS thread running the event loop, freezing every other coroutine scheduled on it for the full duration of the sleep.
Why it matters
time.sleep() blocks the entire OS thread it runs on, and in an async function that thread is running the event loop, so a single time.sleep() call freezes every other coroutine, request, and timer scheduled on that loop for its whole duration. In a web server or any concurrent async service, this turns one slow path into a stall that affects every unrelated in-flight request at the same time, which is a much bigger blast radius than the same delay in synchronous code.
How to fix it
Replace time.sleep(n) with await asyncio.sleep(n), which yields control back to the event loop for the duration of the delay instead of blocking it. If the delay is meant to throttle a synchronous piece of work that must run in a real thread, run that work in an executor with loop.run_in_executor(...) instead of sleeping inline.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo