File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/resolver/process/storage/connector/sync Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 1616import dev .openfeature .flagd .grpc .sync .Sync .SyncFlagsResponse ;
1717import dev .openfeature .sdk .Awaitable ;
1818import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
19+ import io .grpc .Status ;
20+ import io .grpc .StatusException ;
21+ import io .grpc .StatusRuntimeException ;
1922import io .grpc .stub .StreamObserver ;
2023import java .util .concurrent .BlockingQueue ;
2124import java .util .concurrent .LinkedBlockingQueue ;
@@ -144,13 +147,23 @@ private Struct getMetadata() {
144147 localStub = localStub .withDeadlineAfter (deadline , TimeUnit .MILLISECONDS );
145148 }
146149
147- GetMetadataResponse metadataResponse = localStub .getMetadata (GetMetadataRequest .getDefaultInstance ());
150+ try {
151+ GetMetadataResponse metadataResponse = localStub .getMetadata (GetMetadataRequest .getDefaultInstance ());
148152
149- if (metadataResponse != null ) {
150- return metadataResponse .getMetadata ();
151- }
153+ if (metadataResponse != null ) {
154+ return metadataResponse .getMetadata ();
155+ }
156+
157+ return null ;
158+ } catch (StatusRuntimeException e ) {
159+ // In newer versions of flagd, metadata is part of the sync stream. If the method is unimplemented, we
160+ // can ignore the error
161+ if (Status .UNIMPLEMENTED .equals (e .getStatus ())) {
162+ return null ;
163+ }
152164
153- return null ;
165+ throw e ;
166+ }
154167 }
155168
156169 private void syncFlags (SyncStreamObserver streamObserver ) {
You can’t perform that action at this time.
0 commit comments