fleetlint Policy for a fleet of repositories
v0.8
Getting started

slop/arbitrary-delays

No sleeps outside tests

Severityinfo
Tiersall
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.5.0
Selected byfleetlint-slop@v0.5.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]')
false

Fix

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.5.0.