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

refactor(op_crates/websocket): refactor event loop #9079

Merged
merged 3 commits into from
Jan 10, 2021

Conversation

crowlKats
Copy link
Member

No description provided.

@@ -294,59 +294,78 @@
}

async #eventLoop() {
if (this.#readyState === OPEN) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a behavioral change - is something being fixed here?

Copy link
Member Author

@crowlKats crowlKats Jan 10, 2021

Choose a reason for hiding this comment

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

no behaviour is identical. no fixes, just a cleanup i have been meaning to do for a while.
before it was recursive calls, now just a while loop.

Copy link
Member

Choose a reason for hiding this comment

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

Why does this if statement change to a while?

Copy link
Member Author

Choose a reason for hiding this comment

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

as mentioned, it was recursive calls. that if was the guard if to get the next. since i changed to a while loop and the calls are not recursive anymore, it is equivalent. this.#readyState gets only changed if the ws closes or errors, so the loop would be exited by that changing

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM - thanks crowlKats

@ry ry merged commit 2c1f744 into denoland:master Jan 10, 2021
@crowlKats crowlKats deleted the websocket_refactor branch January 11, 2021 10:39
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

2 participants