Closed Raynos closed 11 years ago
Each fold will initiate completely new read so there are no state connection. For stateful reducers there is hub that manages folders and only actually closes source on last consumer sending back reduced
On Thursday, January 10, 2013, Raynos wrote:
What happens if this is done:
var r = Reducible() fold(r, function (d) { if (d === 5) { return reduced() }}) fold(r, function (d) { if (d === 6) { return reduced() }})
Here there are two folds which both send a signal on back channel saying "I dont need any more data cleanup"
However the second one does it later and he never get's the value 6 although he wanted that value.
— Reply to this email directly or view it on GitHubhttps://github.com/Gozala/reducers/issues/33.
Typed on tiny virtual keyboard
BTW you create reducible by passing function to it. Each fold will cause that function to be executed unless wrapped in something like hub that intentionally alters this behavior
On Thursday, January 10, 2013, Irakli Gozalishvili wrote:
Each fold will initiate completely new read so there are no state connection. For stateful reducers there is hub that manages folders and only actually closes source on last consumer sending back reduced
On Thursday, January 10, 2013, Raynos wrote:
What happens if this is done:
var r = Reducible() fold(r, function (d) { if (d === 5) { return reduced() }}) fold(r, function (d) { if (d === 6) { return reduced() }})
Here there are two folds which both send a signal on back channel saying "I dont need any more data cleanup"
However the second one does it later and he never get's the value 6 although he wanted that value.
— Reply to this email directly or view it on GitHubhttps://github.com/Gozala/reducers/issues/33.
Typed on tiny virtual keyboard
Typed on tiny virtual keyboard
@Gozala oh each fold
does a new read! that's genius, that makes sense.
I was assuming it's hub()
by default because pipe
handles multiple writers with one reader.
how does hub()
handle the case of multiple reduced
signals?
how does hub() handle the case of multiple reduced signals?
It just increments count of readers when they fold and decrements when reduced
is returned. Once count is down to 0
it passes reduced
back to source
to close it too.
In fact that's only thing hub does it just keeps list of open reducers and dispatches yield value across them. If no one else is left to dispatch to it closes source.
It does not looks like anything needs fixing here.
What happens if this is done:
Here there are two folds which both send a signal on back channel saying "I dont need any more data cleanup"
However the second one does it later and he never get's the value 6 although he wanted that value.