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

Feature/Fix greedy drains #19

Merged
merged 2 commits into from
Jul 7, 2022
Merged

Feature/Fix greedy drains #19

merged 2 commits into from
Jul 7, 2022

Conversation

kklingenberg
Copy link
Owner

This PR fixes an issue with the pattern:

await new Promise((resolve) => writable.once("drain", resolve));

which fails if writable is closed, because the "drain" event won't be emitted. The previous PR #18 attempted to solve this by adding a race: Promise.race(drain, close), but that's problematic as well because it schedules the same "close" event listener multiple times. Also, the use of Promise.race with long-lasting promises can cause memory problems.

This PR fixes this following the pointers laid out in the above issue, given by user brainkim.

@kklingenberg kklingenberg self-assigned this Jul 7, 2022
@kklingenberg kklingenberg marked this pull request as ready for review July 7, 2022 17:06
@kklingenberg kklingenberg merged commit cfaa561 into main Jul 7, 2022
@kklingenberg kklingenberg deleted the feature/fix-greedy-drains branch July 7, 2022 17:07
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.

1 participant