Problem
Multiple time.sleep() calls exist in code paths that execute inside the async event loop. This blocks the entire event loop, preventing all other agents/tasks from making progress.
Principle violated: "Performance-first", "Async-safe by default"
Critical Locations in praisonaiagents/agent/execution_mixin.py
| Line |
Call |
Context |
| 956 |
time.sleep(0.5) |
After server start |
| 959 |
time.sleep(0.1) |
Server wait polling loop |
| 988 |
time.sleep(1) |
In loop() |
| 997 |
time.sleep(1) |
In loop() |
| 1056 |
time.sleep(0.5) |
After thread start |
| 1061 |
time.sleep(1) |
In loop() |
Impact
When running multiple agents concurrently via asyncio, a single time.sleep(1) freezes ALL agents for 1 second. The event loop cannot service any other coroutines during blocking sleep calls. In a 10-agent workflow with sequential sleeps, this compounds to seconds of wasted wall-clock time per iteration cycle.
Suggested Fix
- Replace
time.sleep() with await asyncio.sleep() in async contexts
- For sync/async dual code paths, detect the running loop and dispatch accordingly
- Server readiness should use
asyncio.Event signaling instead of polling with sleep
Problem
Multiple
time.sleep()calls exist in code paths that execute inside the async event loop. This blocks the entire event loop, preventing all other agents/tasks from making progress.Principle violated: "Performance-first", "Async-safe by default"
Critical Locations in
praisonaiagents/agent/execution_mixin.pytime.sleep(0.5)time.sleep(0.1)time.sleep(1)loop()time.sleep(1)loop()time.sleep(0.5)time.sleep(1)loop()Impact
When running multiple agents concurrently via
asyncio, a singletime.sleep(1)freezes ALL agents for 1 second. The event loop cannot service any other coroutines during blocking sleep calls. In a 10-agent workflow with sequential sleeps, this compounds to seconds of wasted wall-clock time per iteration cycle.Suggested Fix
time.sleep()withawait asyncio.sleep()in async contextsasyncio.Eventsignaling instead of polling with sleep