Skip to content

docs: document synchronous event listener behavior #126

@coji

Description

@coji

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 async option in a future version → Decided against async emit. See fix: async event listeners silently drop Promises #136 for runtime Promise detection instead.

Decision (from Codex review)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions