-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Problem
Event listeners are called synchronously in the worker's hot path. A slow or error-throwing listener blocks job execution and lease renewal. This is intentional (ensures error propagation) but undocumented — users may add expensive listeners without realizing the impact.
Tasks
- Add warning to Events API docs about synchronous execution
- Document that listeners should be fast and non-blocking
-
Consider adding an→ Decided against async emit. See fix: async event listeners silently drop Promises #136 for runtime Promise detection instead.asyncoption in a future version
Decision (from Codex review)
on()stays synchronous — async emit would push user callback latency into the worker hot path- Listener type stays
void— changing toPromise<void>would be misleading - Runtime Promise detection +
.catch()forwarding toonErrortracked in fix: async event listeners silently drop Promises #136 withLogPersistence()async listener bug also tracked in fix: async event listeners silently drop Promises #136
References
events.tsL308 — synchronous listener loop- Found by Codex code review
- Fix: docs: document synchronous event listener behavior (#126) #135
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels