slop/arbitrary-delays
No sleeps outside tests
| Severity | info |
| Tiers | all |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.6.0 |
| Selected by | fleetlint-slop@v0.6.0 |
Requirement
Non-test code does not block for a fixed time: sleep(, time.sleep(, time.Sleep(, Thread.sleep(, thread::sleep( or a shell sleep N. Asynchronous timers (setTimeout, asyncio.sleep, coroutine delay) are not read.
Why
A delay that papers over an ordering problem fails on a slower machine and wastes time on a faster one.
Check
For each item in:
codegrep("nontest", r'(^|[^.\w:])u?sleep\(|\b(time|Thread)\.[sS]leep\(|\bthread::sleep\(|^\s*sleep\s+[0-9]')falseFix
Wait for the event or condition itself; keep real backoff and rate limiting with a comment saying so.
Agent instruction: Report each delay; replace it with waiting on the actual condition where that is evident, and leave deliberate backoff alone.
Sources
Generated by fleetlint docs from catalog v0.6.0.