reactive-async
reactive-async copied to clipboard
[minor] Add pool.onQuiescent(cell)
Fixes #89 (but see discussion at #89 )
All comments are displayed as outdated, which is not correct (prob. because of the new package/file structure).
This appears to be missing state.quiescenceCellHandlers. Otherwise, quiescence cell handlers are only run upon registration if the pool is already quiescent at that point. Also, it would be good to add a test which would catch this issue (i.e., register quiescence cell handler when the pool is definitely not quiescent, and verify the handler runs eventually).
--You are right. I am going to address this.-- This issue should be fixed now, two tests have been added.
Why do we store NextCallbackRunnables, and not just closures like with quiescenceHandlers? One thing I'm a bit skeptical about is that NextCallbackRunnable[_, _] is a wildcard type, adding complexity which I'm not sure is warranted.
Along with every callback, we need to store the cell whose value is passed to the callback as soon as quiescence is reached. That's quite exactly, what NextCallbackRunnable is used for in onnext. Otherwise, we would need to add a new class Foo[K, V](val cell: Cell[K, V], val handler: V => Unit) and store a List[Foo[_, _]]. (I am not sure how to get rid of the wildcards.)
Unused import?
The imports you commented on are used. Am I missing unused once?