- Bus defaults (applies to all events/handlers unless overridden)
- Per-event overrides (applies to one emitted event instance)
- Per-handler overrides (applies to one handler registration)
examples/concurrency_options.pybubus-ts/examples/concurrency_options.tsexamples/log_tree_demo.pybubus-ts/examples/log_tree_demo.ts
Timeout types
1) Event timeout (event_timeout)
The outer execution budget for an event. This also acts as an upper cap for each handler run for that event.
2) Handler timeout (event_handler_timeout / handler_timeout)
A handler-specific timeout budget. The effective handler timeout is resolved from handler -> event -> bus, then capped by event_timeout when both are set.
3) Slow-warning thresholds (event_slow_timeout, event_handler_slow_timeout, handler_slow_timeout)
These emit warnings when work is taking longer than expected:
event_slow_timeout: warns when event processing is still running past the threshold.event_handler_slow_timeout/handler_slow_timeout: warns when a handler run is still running past the threshold.
Where to set each value
| Level | Execution timeout fields | Slow-warning fields |
|---|---|---|
| Bus | event_timeout | event_slow_timeout, event_handler_slow_timeout |
| Event | event_timeout, event_handler_timeout | event_slow_timeout, event_handler_slow_timeout |
| Handler | handler_timeout | handler_slow_timeout |
Bus-level defaults
Set default budgets and warning thresholds once when creating a bus.- Python
- TypeScript
Event-level overrides
Set per-event values when emitting an event instance.- Python
- TypeScript
Handler-level overrides
Set per-handler timeout and slow-warning overrides at registration time (or by updating the returned handler metadata).- Python
- TypeScript
Precedence rules
Effective handler timeout
- Resolve handler timeout source:
handler_timeout(handler level)- else
event_handler_timeout(event level) - else bus
event_timeout
- Apply event cap:
- effective timeout is
min(resolved_handler_timeout, event_timeout)when both are set - if one is unset, the other value is used
- if both are unset, no timeout is enforced
- effective timeout is
Effective handler slow-warning threshold
Resolved in this order:handler_slow_timeoutevent_handler_slow_timeoutevent_slow_timeout- bus
event_handler_slow_timeout - bus
event_slow_timeout
Effective event slow-warning threshold
Resolved in this order:event_slow_timeout- bus
event_slow_timeout
Note on retry
Bus/event timeouts are outer budgets. If you need per-attempt limits for retried handlers, use theretry decorator’s timeout option.