-
-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Awaiting ctx.emit behave differently locally and remotely #1065
Labels
Type: Discussion
Discussion issue about a feature
Comments
@icebob This one affects |
Anton-Burdin
added a commit
to intech/moleculer
that referenced
this issue
May 31, 2022
Anton-Burdin
added a commit
to intech/moleculer
that referenced
this issue
Jun 1, 2022
…ally and remotely issue moleculerjs#1065" This reverts commit 0ff0f9d.
Anton-Burdin
added a commit
to intech/moleculer
that referenced
this issue
Jun 1, 2022
Anton-Burdin
added a commit
to intech/moleculer
that referenced
this issue
Jun 2, 2022
9 tasks
Anton-Burdin
added a commit
to intech/moleculer
that referenced
this issue
Jun 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🛑 Do you want to ask a question ?
Please head to the Discord chat
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Current Behavior
When awaiting a
ctx.emit
call, the promise wait for the event to be completed locally but will resolve as soon as the event is sent on the transit when sent remotely.A workaround for now is to remove the await but if the
emit
is wrapped by a middleware, it prevents it to be async.This can be found here:
moleculer/src/service-broker.js
Lines 1357 to 1389 in 1fa2440
Expected Behavior
I would expect to have a consistent behavior for both cases. I'd say I'd expect the local event to not wait for completion (matching the remote behavior).
Note: It could break tests with events that relies on this behavior.
Failure Information
Reproduce code snippet
Gives an output like this:
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
The text was updated successfully, but these errors were encountered: