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: await reconciliation bug #187

Merged
merged 3 commits into from
Nov 29, 2024
Merged

fix: await reconciliation bug #187

merged 3 commits into from
Nov 29, 2024

Conversation

nicklasl
Copy link
Member

@nicklasl nicklasl commented Nov 28, 2024

There was a case for race conditions that could occur when calling putContext() followed by a awaitReconciliation() where the contextChanges updates did not trigger a fetchAndActivate before awaitReconciliation had finished.

Replaces #185

@nicklasl nicklasl marked this pull request as ready for review November 29, 2024 09:13
suspend fun awaitReconciliation(timeoutMillis: Long = 5000) {
if (timeoutMillis <= 0) error("timeoutMillis need to be larger than 0")
debugLogger?.logMessage("reconciliation started")
yield() // will make sure that we respect other coroutine scopes triggered before this
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the actual fix. The rest is mainly just improvements.

@nicklasl nicklasl merged commit a352533 into main Nov 29, 2024
2 checks passed
@nicklasl nicklasl deleted the new-await-reconcile branch November 29, 2024 11:56
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.

2 participants