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

Pipe back pressure issue #273

Merged
merged 1 commit into from
Jun 25, 2012
Merged

Pipe back pressure issue #273

merged 1 commit into from
Jun 25, 2012

Conversation

mafintosh
Copy link
Contributor

Currently request doesn't return a boolean from write to indicate whether or not the write was flushed nor does it emit a drain event.

This can result in a large memory overhead when piping large files to request because of back pressure.
Consider:

fs.createReadStream('i_am_large.file').pipe(request.put('http://...');

If the above readstream reads faster than request can write we'll end up having most of the file in memory.
This patch fixes this issue by adding the drain event and returning the boolean from req.write.

mikeal added a commit that referenced this pull request Jun 25, 2012
@mikeal mikeal merged commit 9746bb4 into request:master Jun 25, 2012
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.

2 participants