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

How to handle backpressure? #78

Closed
liran opened this issue Sep 9, 2020 · 5 comments · Fixed by #115
Closed

How to handle backpressure? #78

liran opened this issue Sep 9, 2020 · 5 comments · Fixed by #115
Labels
question Question about any part of the module released

Comments

@liran
Copy link

liran commented Sep 9, 2020

When writing a large file, if we don't have a drain event, how do we handle backpressure?
about drain : https://nodejs.org/api/stream.html#stream_event_drain

@liran liran added the bug Something isn't working label Sep 9, 2020
@Rapsssito Rapsssito added question Question about any part of the module and removed bug Something isn't working labels Sep 10, 2020
@Rapsssito
Copy link
Owner

@liran, thanks for the feedback! I don't know about "backpressure" or the "drain" event. I will inform myself and come back to you when I have something.

@liran
Copy link
Author

liran commented Sep 10, 2020

If the receiver adjusts the speed of receiving data through pause() and resume(), the corresponding sender also needs to slow down the data writing speed.
Through the drain event, the sender can control the write speed.
Therefore, when implementing pause() and resume() for the receiver in #41, the drain event should also be implemented for the sender.

@Rapsssito
Copy link
Owner

Rapsssito commented Sep 11, 2020

@liran, I will add a drain event when socket.pause() and socket.resume() are implemented. In the meantime, a hacky workaround might be using the callback argument provided to socket.write() and a little extra code logic.

@liran
Copy link
Author

liran commented Sep 11, 2020

@Rapsssito Thank you for your efforts.

@github-actions
Copy link

🎉 This issue has been resolved in version 5.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about any part of the module released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants