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(ext/fetch): make EventSource more robust #22493

Merged
merged 1 commit into from Mar 24, 2024

Conversation

0f-0b
Copy link
Contributor

@0f-0b 0f-0b commented Feb 20, 2024

This PR fixes all unhandled rejections and resource leaks found while adding a test for #22368.

@0f-0b 0f-0b force-pushed the eventsource-unhandled-rejection branch from 83d2292 to f1f6ad8 Compare February 20, 2024 10:47
@0f-0b 0f-0b force-pushed the eventsource-unhandled-rejection branch from f1f6ad8 to aee159a Compare February 27, 2024 13:23
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Looks good to me, though I did leave a few nitpicks. If you want to fix them, by all means do. Otherwise we'll merge this in the coming days.

ext/fetch/27_eventsource.js Outdated Show resolved Hide resolved
ext/fetch/27_eventsource.js Outdated Show resolved Hide resolved
ext/fetch/27_eventsource.js Outdated Show resolved Hide resolved
ext/fetch/27_eventsource.js Show resolved Hide resolved
if (this[_readyState] !== CLOSED) {
this[_readyState] = OPEN;
this.dispatchEvent(new Event("open"));
if (this[_readyState] === CLOSED) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

praise: Nice inversion of ifs to reduce unnecessary indentation.

ext/fetch/27_eventsource.js Show resolved Hide resolved
if (this[_lastEventID] !== "") {
lastEventIDValue = this[_lastEventID];
}
this[_reestablishConnection]();
Copy link
Collaborator

Choose a reason for hiding this comment

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

praise: Excellent deduplication work!

@lino-levan
Copy link
Contributor

@aapoalas Any ideas why the CI failed? Seems like a flaky test to me.

@aapoalas
Copy link
Collaborator

@aapoalas Any ideas why the CI failed? Seems like a flaky test to me.

Lint failed from clippy not running or finding something fishy. Either main contained something fishy or it's indeed flaky :/

@0f-0b 0f-0b force-pushed the eventsource-unhandled-rejection branch from 8ee5834 to 41a494f Compare March 24, 2024 14:57
Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

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

LGTM!

@crowlKats crowlKats merged commit d263c63 into denoland:main Mar 24, 2024
17 checks passed
@0f-0b 0f-0b deleted the eventsource-unhandled-rejection branch March 24, 2024 18:18
crowlKats pushed a commit that referenced this pull request Mar 25, 2024
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.

None yet

4 participants