-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
If flagd is not available getting a flag value hangs forever, not respecting deadlines.
If there is no flagd running on localhost, the below sample client will hang forever instead of returning the default value after a deadline.
POM.xml
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>dev.openfeature</groupId>
<artifactId>sdk</artifactId>
<version>1.14.2</version>
</dependency>
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>flagd</artifactId>
<version>0.11.3</version>
</dependency>
</dependencies>
Main.java
public class Main {
public static void main(String[] args) throws InterruptedException {
FlagdProvider flagdProvider = new FlagdProvider() ;
OpenFeatureAPI openFeatureAPI = OpenFeatureAPI.getInstance();
openFeatureAPI.setProvider(flagdProvider) ;
openFeatureAPI.onProviderError(eventDetails -> {
System.out.println("Attempting to read a flag");
var flagValue = openFeatureAPI
.getClient()
.getBooleanValue("nonexistent", false) ;
System.out.println("flagValue: " + flagValue);
}) ;
// Blocking the main thread for a while to give the provider time get into an error state
Thread.sleep(2000);
}
}
Metadata
Metadata
Assignees
Labels
No labels