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

fix(event-catalog): local emit & broadcast handlers changed from async to event-driven #1096

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

intech
Copy link
Member

@intech intech commented Jun 5, 2022

🎯 Relevant issues

issue#1065

💎 Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

🏁 Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

@@ -223,7 +222,8 @@ describe("Test Tracing feature with actions", () => {
}
});

await Promise.delay(500);
// event loop lag <10ms
await Promise.delay(510);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this issue is the next tick in node v10, and the test fails. The timeout should be 510ms (although it works with 501ms) because the action already has a 500ms timeout.
It is likely that after v10, optimization was carried out for placing events in a queue, and on later versions, the test passed successfully with the same delay of 500 ms.

@intech intech changed the title fix(service-broker): local emit & broadcast handlers changed from async to event-driven fix(event-catalog): local emit & broadcast handlers changed from async to event-driven Jun 6, 2022
@@ -35,6 +38,20 @@ class EventCatalog {
this.events = [];

this.EndpointFactory = EventEndpoint;

this.on("broker.event", ctx => {
Copy link
Member

@icebob icebob Jun 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we should use an event emitter to call a non-await-ed method? I feel it's too expensive. Not enough just skip the await in the callEventHandler

@icebob icebob added this to the 0.15 milestone Dec 18, 2022
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.

3 participants