-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Batch updates and readers #91
Comments
It is true that current implementation of observing via cursors may not expose every value when two actions happen very close in time. This is not really a data race. This works for UI since you are only interested in the "current" value and not every single intermediate value. I think this could be changed if you have a good use-case for observing every single intermediate value. I can guide you through the code on why this is happening and we can discuss ways to change it. |
Btw, as a workaround, to use the store as an event listener, you can call your callbacks in an effect returned by the |
Thank you, calling it in effects does help (although leads to more code lol). |
I'd be happy to have a tag for the |
Simply using a reader will not always call the callbacks after emitting an event, which means we will frequently miss events (arximboldi/lager#91). This commit calls the callbacks in the effect returned by the reducer instead.
Consider the following program:
One may expect that upon running this one will get 100 lines of output from 1 to 100. But this is actually not the case. It actually only outputs starting from ~50 and will sometimes skip values.
Is this expected? From my understanding, the dispatch() is just a call to event loop's post(), which should run the whole push_down() process, including those notify()s, which basically call the connected callback function, in io_context's thread (which we detach()ed earlier). If this is correct, there should not be any data races and no output should be skipped... but it is not the case.
The thing behind this is that I am trying to use store as an event listener (https://gitlab.com/kazv/libkazv/-/blob/servant/src/eventemitter/lagerstoreeventemitter.hpp). Or does this idea just not work?
The text was updated successfully, but these errors were encountered: