Skip to content
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

Fix race condition on first task attempt in update #28

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

andrewMacmurray
Copy link
Owner

@andrewMacmurray andrewMacmurray commented Jan 24, 2024

In some cases where a task was first started in update, the sub-tasks would not be run. This was because the Elm model was not updated in time before the first poolId was received.

Adding a Promise.resolve wrapper around the send({ poolId }) gives elm enough time to tick the model forward.

When first attempting a task in `update` (but not in `init`) the sub tasks were not run. The reason for this is because the model was not updated in time for the identify message.

Adding Promise.resolve around the send command allows a tick to happen so elm can update the model in time
@andrewMacmurray andrewMacmurray merged commit 553a371 into main Mar 15, 2024
4 checks passed
@andrewMacmurray andrewMacmurray deleted the fix-update-race-condition branch March 15, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant