Skip to content

Commit

Permalink
Clarify execution order of .on vs .onAny event listeners in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jansivans committed Feb 20, 2024
1 parent 1cc6620 commit a548122
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const job = new bellboy.Job(

Event listeners, which can be registered with `job.on` or `job.onAny` methods, allow you to listen to specific events in the job lifecycle and to interact with them.

- When multiple listeners are registered for the same event, those added using `.on` will always be executed first, regardless of the order in which they were added compared to `.onAny`. This ensures that specific event listeners have priority over generic ones.
- When multiple listeners are registered for a single event, those added by [reporters](#reporters) will be executed first, followed by the order of registration for the remaining listeners.
- Job always waits for the code inside a listener to complete.
- Any error thrown inside a listener will be ignored and warning message will be printed out.
Expand Down

0 comments on commit a548122

Please sign in to comment.