Skip to content
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

Remove $Changed from logical flow of emitter #1394

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lauckhart
Copy link
Collaborator

Previously we were providing the ActionContext of the emitter to $Changed handlers. The transaction was destroyed in this case so was not really useful. Now we instead just provide metadata about the subject that triggered the change.

Also, the emitter was awaiting $Changed handlers if they were async. There are advantages and disadvantages to doing this:

  • Advantage is that the logical flow is more deterministic and we track the promise as a normal part of node activity
  • The disadvantage is that the emitter blocks until an independent process completes

This commit makes it so $Changed handlers operate independently of the emitter. Tests pass but effects will be subtle so will need to keep an eye on this.

Previously we were providing the ActionContext of the emitter to $Changed handlers.  The transaction was destroyed in this case so was not really useful.  Now we instead just provide metadata about the subject that triggered the change.

Also, the emitter was awaiting $Changed handlers if they were async.  There are advantages and disadvantages to doing this:

* Advantage is that the logical flow is more deterministic and we track the promise as a normal part of node activity
* The disadvantage is that the emitter blocks until an independent process completes

This commit makes it so $Changed handlers operate independently of the emitter.  Tests pass but effects will be subtle so will need to keep an eye on this.
@Apollon77
Copy link
Collaborator

see review comments in Discord - also reason for the failed testcase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants