-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add means of awaiting event emission, fix flaky build #1463
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
Merged
toddbaert
merged 17 commits into
open-feature:main
from
chrfwow:Flaky-build-due-to-a-possible-race-condition-#1449
Jun 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
306b74f
Flaky build due to a possible race condition #1449
chrfwow 5bd4586
Flaky build due to a possible race condition #1449
chrfwow caae39d
Flaky build due to a possible race condition #1449
chrfwow 5909f33
Flaky build due to a possible race condition #1449
chrfwow 43c06f3
Flaky build due to a possible race condition #1449
chrfwow 9e2cbd8
Flaky build due to a possible race condition #1449
chrfwow 694526e
Flaky build due to a possible race condition #1449
chrfwow 95d2271
Flaky build due to a possible race condition #1449
chrfwow 0738f9f
Flaky build due to a possible race condition #1449
chrfwow 3a1ce09
Flaky build due to a possible race condition #1449
chrfwow 5ab1f68
Flaky build due to a possible race condition #1449
chrfwow 1feacdd
Flaky build due to a possible race condition #1449
chrfwow 6a4fa3d
Flaky build due to a possible race condition #1449
chrfwow c22da3e
Merge branch 'main' into Flaky-build-due-to-a-possible-race-condition…
toddbaert 14d8c12
Merge branch 'main' into Flaky-build-due-to-a-possible-race-condition…
toddbaert 596fe22
Update src/main/java/dev/openfeature/sdk/Awaitable.java
toddbaert 0228a70
Update src/main/java/dev/openfeature/sdk/Awaitable.java
toddbaert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not nice to access the static lock that's clearly only exposed for testing, but we need to use this very lock to protect against concurrent reads/writes to the underlying map.
I removed the call to the
emitterExecutor
, so now all listeners are invoked sequentially on the calling thread. This was needed as several tests expect the state of the provider to be set immediately after calling this method.If we consider this a problem, I could work around this issue by returning something our tests can wait for. In this case, we would need to call both the
localOnEmit
and thelocalEventProviderListener
in theemitterExecutor
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By moving the call from the
emitterExecutor
to the current thread, I reintroduced a race condition that was already fixed.Therefore I added the executor again. This means that some tests will fail that expect the state of the provider to be updated immediately after a call to
emit
. This is why I now return anAwaitable
, for which those tests (or users) can wait.