AsyncBatcher: Tracking in flight batches #222
shidel-dev
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was hopeful that I could do the following:
Server State -> apply idle + pending batches client side -> optimistic state. Then once batches commit have a new Base Server State (plus any new idle actions that happened during the save).
this is conceptually nice as any changes that happen during a ongoing save are not trampled by the new server state from a previous commit.
However I noticed that AsyncBatcher just clears it's items before doing the execute. To me this seems like a weird choice, as those pending batches are kind of lost as far as the state subscriptions go. As far as I could tell it only records a count for how many are currently executing.
here is the code in question:
pacer/packages/pacer/src/async-batcher.ts
Lines 384 to 403 in a894009
Between the call to clear, and the call to onSuccess the state for the inflight items is lost, thus requiring anyone who wants to purely derive the optimistic state from the idle + inflight actions to have to do their own book keeping.
I believe that logically there should be state which captures the inflight items that can be subscribed to.
Beta Was this translation helpful? Give feedback.
All reactions