Skip to content

Conversation

@lforst
Copy link
Contributor

@lforst lforst commented Jul 3, 2024

Makes e2e tests less flakey by adding an event buffer that is used to send events to callback listeners that have not managed to connect in time for a particular events.

We do this by letting the event listeners also send along a timestamp from which point onwards they would like to receive events.

The race condition would have happened when a listener is registered and an event is triggered right after, meaning the event would escape the provided callback because the listener hasn't connected yet. Slim chance but happens.

We will consume more memory by buffering but it is hopefully managable. GH runners are free right?

@lforst lforst requested a review from mydea July 3, 2024 11:45
@lforst lforst requested a review from AbhiPrasad July 3, 2024 15:32
/** Wait for a request to be sent. */
export async function waitForRequest(
proxyServerName: string,
timestamp: number,
Copy link
Member

Choose a reason for hiding this comment

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

m: Can we make this optional, as third argument, and just default to Date.now()? I guess we'll want this like this basically always? 😅 (same for the other methods)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah made it optional

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

sweet!

@lforst lforst merged commit 993acd4 into develop Jul 4, 2024
@lforst lforst deleted the lforst-event-proxy-no-race-condition branch July 4, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants