-
Notifications
You must be signed in to change notification settings - Fork 26
WaitPub
may wait more than necessary
#38
Comments
/cc @Stebalien |
Yep, that looks like a bug. Really, the bug starts in |
I think the easiest solution at the moment would be to remove This would entail adding a couple of checks in It would also help alleviate the concurrent @Stebalien WDYT? |
(The changes would also take care of #35.) |
The republisher is designed for IPNS where publishing is really expensive. For that, The issue is that we're also using this to store the latest root on disk. In that case, I'd expect a call to Flush/Close (on a file) to flush all the way to disk synchronously (asking the user to then wait on the republisher has is pretty poor UX).
The republisher doesn't currently have a concept of "closing" so I'm not sure what this would entail. |
Could you expand on that please? My proposed solution doesn't entail generating more Lines 250 to 253 in 2c1b835
which now would happen in the same lock acquisition already present (saving some contention and simplifying the code), Lines 319 to 322 in 2c1b835
Agreed, but that seems a responsability of the consumer of MFS who supplied the
Lines 263 to 267 in 2c1b835
|
Ah, got it. Yeah, that sounds like a good solution (it should also simplify this code quite a bit).
That's how this currently works but:
A simple alternative would be to:
republisher, onChange := NewDebouncedRepublisher(someCallback, shortTimeout, longTimeout)
root := NewRoot(nd, onChange) (or something like that,
Not sure how I missed that... SGTM. |
Agreed, this sounds like a good proposal for #33. |
Before, WaitPub could wait forever if a value was published at the same time as the call to WaitPub. This patch also avoids republishing the same value multiple times and allows setting an initial value without reaching in and modifying internal state. fixes #38
Before, WaitPub could wait forever if a value was published at the same time as the call to WaitPub. This patch also avoids republishing the same value multiple times and allows setting an initial value without reaching in and modifying internal state. fixes #38
Before, WaitPub could wait forever if a value was published at the same time as the call to WaitPub. This patch also avoids republishing the same value multiple times and allows setting an initial value without reaching in and modifying internal state. fixes #38
Before, WaitPub could wait forever if a value was published at the same time as the call to WaitPub. This patch also avoids republishing the same value multiple times and allows setting an initial value without reaching in and modifying internal state. fixes #38
(I may not be completely following the
Republisher
logic here.)WaitPub
sends a channel to a channel forRun
to take it and signal through it that thepublish
has been issued,go-mfs/system.go
Lines 258 to 260 in 2c1b835
but the channel
pubnowch
through which the "inner"pubnowresp
channel is being sent is processed in parallel with thepublish
timers,go-mfs/system.go
Lines 299 to 307 in 2c1b835
with the intention (I'm assuming) that it will trigger an instantaneous
publish
without waiting for the timeouts (since someone is waiting for it).Through this signaling mechanism there is the non-negligible chance (I think) that any of the timers will be processed instead of the
pubnowch
channel which would mean that the publish will indeed happen but the user will keep waiting an indefinite amount of time until another value is sent to theRepublisher
.The text was updated successfully, but these errors were encountered: