Skip to content

Conversation

@segayuu
Copy link
Contributor

@segayuu segayuu commented Aug 31, 2018

When using Warehouse#save(), due to its characteristics, it may cause memory exhaustion if it does not correspond to backpressure.

It is simple in the current implementation, but if backpressure is not supported, it is faster to use fs.writeFile().
Corresponding to backpressure means reducing memory to use as much as possible, not sending information more than necessary to Writable, interrupting processing as soon as possible when Writable asks for interruption is.
To deal with these we have added dependencies on the "json-stream-stringify" library.

Change stream used inside "Warehouse#save()" to correspond to backpressure.
@segayuu segayuu requested a review from a team August 31, 2018 04:30
@tcrowe
Copy link
Contributor

tcrowe commented Aug 31, 2018

That seems like a good idea @segayuu 👍🏼

Copy link
Contributor

@tcrowe tcrowe left a comment

Choose a reason for hiding this comment

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

👍🏼

@segayuu segayuu merged commit edc14c9 into hexojs:master Sep 9, 2018
@segayuu segayuu deleted the use-readable-from-warehouse#save() branch September 9, 2018 07:41
@SukkaW SukkaW mentioned this pull request Oct 11, 2019
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