Skip to content

Should I wait for the broker.broadcast => Promise<void>? #1067

Answered by shawnmcknight
rulrok asked this question in Q&A
Discussion options

You must be logged in to vote

Personally, I don't see any reason to await the event response unless for some reason you don't wish to proceed with the rest of the execution flow until it returns. In our project, we use broker.broadcast(...).catch((err) => { ... log error ... }); so we can fire-and-forget the events but if there happens to be an error it gets logged. We don't want it to throw in that case.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rulrok
Comment options

Answer selected by icebob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants