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

[flagd] improve wait logic to a more elegant solution #1160

Open
aepfli opened this issue Jan 16, 2025 · 0 comments · May be fixed by #1169
Open

[flagd] improve wait logic to a more elegant solution #1160

aepfli opened this issue Jan 16, 2025 · 0 comments · May be fixed by #1169
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@aepfli
Copy link
Member

aepfli commented Jan 16, 2025

Our current waiting logic could be improved. It is a working wait logic, but it might not be the most elegant solution.

public static void busyWaitAndCheck(final Long deadline, final Supplier<Boolean> connectedSupplier)
throws InterruptedException {
long start = System.currentTimeMillis();
do {
if (deadline <= System.currentTimeMillis() - start) {
throw new GeneralError(String.format(
"Deadline exceeded. Condition did not complete within the %d " + "deadline", deadline));
}
Thread.sleep(50L);
} while (!connectedSupplier.get());
}

This task aims to migrate to an approach with notify() and wait(). As suggested by @chrfwow within #1115.

@aepfli aepfli added good first issue Good for newcomers help wanted Extra attention is needed labels Jan 16, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 20, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 21, 2025
…ant-solution-open-feature#1160

# Conflicts:
#	providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java
#	providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/resolver/process/InProcessResolver.java
#	providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/resolver/process/InProcessResolverTest.java
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 21, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 21, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 21, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 21, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 22, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 22, 2025
chrfwow added a commit to chrfwow/java-sdk-contrib that referenced this issue Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants