Concurrency and Dispatching in the Tilt Store
masterWhen interacting with the Tilt Store, developers must account for the following concurrency behaviors:
- Synchronized
OnChange: A subscriber'sOnChangemethod is synchronized. TheStorewill not invokeOnChangeon a specific subscriber again until the previousOnChangeexecution has completed. - Asynchronous
Dispatch: Callingstore.Dispatch(action)is non-blocking. The action is placed into a FIFO queue, and the function returns immediately. - Action Batching: The
Storetypically processes actions in batches after a backoff period. - State Skipping: Because actions are batched, subscribers should not assume they will receive an
OnChangecall for every single individual action. For example, if a resource is created and then immediately deleted, the resulting actions might be grouped together, and a subscriber might only see the final state (the resource being gone) without ever seeing the intermediate 'created' state.