-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement finalize
function
#35
Comments
Only solution I can imagine of is by required This also means that errors may occur in attempt to |
@Raynos feedback and suggestions on this subject is very welcome. |
This is a pain in the ass. All I want to know is whether a reducible is finished not being able to put more values into a reducible. Finalize means we can add more values into a finished reducible which is silly. You need some kind of onBeforeFinish hook which can't be done when user sends reduced(...) You can still do finalize just don't reduce the result of it. |
At the moment once reducer returns
reduced(result)
consumedinput
is signaled that reducer no longer wishes to consume it. In a way it's a signal to stop an input. Any furthervalues yield will are suppressed by reducible which is core function for creating reducibles.
Unfortunately this design choice prevents performing any asynchronous finalization tasks after
reduced(value)
is returned. Consider a case where reducible task represents:If only parts of the content is read
fs.close
is never executed. Obviously this can befixed by adding some function like
finalize
:The problem is though that according to an API stream should not yield anything after
reduced(value)
is returned by a consumer. Although if async task is just executed incase of error there will be no one handling it.
The text was updated successfully, but these errors were encountered: