Race condition issue in credit check example #4895
-
I'm not sure if this is a bug or misuse on my part, so apologies if this is better suited as an issue instead of a Q/A; this felt like a safer place to start. In the credit check example, I run into a problem where the calls to the observer's I have a repository with a minimal recreation of the issue: https://github.com/gepenrose/xstate-exmple-issue
I have a hacky temporary solution to get around this in my project, but I was wondering if there was any recommended way to fix this, if this is something that can be fixed in the example, or if this is something that can be fixed in XState. The only solution that comes to mind on the XState side is a mechanism to subscribe to emitted snapshots synchronously where the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Thanks for the report! From initial glance, it seems like the best way to fix this is to use a task queue. Whenever you get a new snapshot, add it to the task queue and process saving the snapshots one at a time. |
Beta Was this translation helpful? Give feedback.
Thanks for the report! From initial glance, it seems like the best way to fix this is to use a task queue.
Whenever you get a new snapshot, add it to the task queue and process saving the snapshots one at a time.