Should I wait for the broker.broadcast => Promise<void>? #1067
-
Hello, I was wondering what is the difference if I do
and
The same question would be valid for |
Beta Was this translation helpful? Give feedback.
Answered by
shawnmcknight
Mar 11, 2022
Replies: 1 comment 1 reply
-
Personally, I don't see any reason to |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
icebob
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 usebroker.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.