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

feat: Add awaitReconciliation #183

Closed
wants to merge 6 commits into from

Conversation

fabriziodemaria
Copy link
Member

No description provided.

Comment on lines +345 to +349
Task {
await confidence.putContext(context: ["hello": .init(string: "world")])
}
try await Task.sleep(nanoseconds: 100 * 1000) // 100 ms wait
await confidence.awaitReconciliation()
Copy link
Member Author

@fabriziodemaria fabriziodemaria Dec 5, 2024

Choose a reason for hiding this comment

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

It's impossible to know if a putContext from another thread (Task) has been started or not (although it's always possible to know when it's done, via await putContext): even for a real application, the awaitReconciliation() could always be called "too soon" with respect to putContexts being started. In fact, I couldn't come up with a programmatic way to test this that doesn't include a sleep

Copy link
Member Author

@fabriziodemaria fabriziodemaria Dec 5, 2024

Choose a reason for hiding this comment

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

In other words, this function would be more useful if putContext wasn't awaitable. I am now unsure if having both await putContext and await awaitReconciliation makes sense

@fabriziodemaria fabriziodemaria force-pushed the api-adjustments branch 23 times, most recently from f88f8d9 to a4e3dd1 Compare December 9, 2024 18:29
@fabriziodemaria fabriziodemaria force-pushed the api-adjustments branch 2 times, most recently from 8e6294f to 76410f6 Compare December 10, 2024 09:43
@fabriziodemaria fabriziodemaria deleted the api-adjustments-2 branch December 10, 2024 15:58
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