Skip to content

Commit 2f7a431

Browse files
committed
fixup: spotless and gemini feedback
Signed-off-by: Simon Schrottner <[email protected]>
1 parent d9f840f commit 2f7a431

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

providers/flagd/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ export FLAGD_SOURCE_SELECTOR="source=my-app"
8585
>
8686
> Users do not need to make any code changes. The SDK handles selector normalization automatically.
8787
88-
**Backward compatibility:**
89-
- Both header and request body approaches work with current flagd versions
90-
- Older flagd versions that only support request body selectors are still supported
91-
- Future flagd versions may remove request body selector support, but the SDK will continue to work using headers
92-
9388
For more details on selector normalization, see the [flagd selector normalization issue](https://github.com/open-feature/flagd/issues/1814).
9489

9590
#### Sync-metadata

providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/resolver/process/storage/connector/sync/SyncStreamQueueSource.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
justification = "Random is used to generate a variation & flag configurations require exposing")
4444
public class SyncStreamQueueSource implements QueueSource {
4545
private static final int QUEUE_SIZE = 5;
46+
private static final Metadata.Key<String> FLAGD_SELECTOR_KEY =
47+
Metadata.Key.of("flagd-selector", Metadata.ASCII_STRING_MARSHALLER);
4648

4749
private final AtomicBoolean shutdown = new AtomicBoolean(false);
4850
private final int streamDeadline;
@@ -67,16 +69,15 @@ public SyncStreamQueueSource(final FlagdOptions options, Consumer<FlagdProviderE
6769
maxBackoffMs = options.getRetryBackoffMaxMs();
6870
syncMetadataDisabled = options.isSyncMetadataDisabled();
6971
channelConnector = new ChannelConnector(options, onConnectionEvent, ChannelBuilder.nettyChannel(options));
70-
72+
7173
// Apply selector header interceptor if selector is configured
7274
Channel channel = channelConnector.getChannel();
7375
if (selector != null) {
7476
channel = io.grpc.ClientInterceptors.intercept(channel, createSelectorInterceptor(selector));
7577
}
76-
78+
7779
flagSyncStub = FlagSyncServiceGrpc.newStub(channel).withWaitForReady();
78-
metadataStub = FlagSyncServiceGrpc.newBlockingStub(channelConnector.getChannel())
79-
.withWaitForReady();
80+
metadataStub = FlagSyncServiceGrpc.newBlockingStub(channel).withWaitForReady();
8081
}
8182

8283
// internal use only
@@ -211,7 +212,7 @@ private void syncFlags(SyncStreamObserver streamObserver) {
211212

212213
streamObserver.done.await();
213214
}
214-
215+
215216
/**
216217
* Creates a ClientInterceptor that adds the flagd-selector header to gRPC requests.
217218
* This is the preferred approach for passing selectors as per flagd issue #1814.
@@ -223,16 +224,12 @@ private static ClientInterceptor createSelectorInterceptor(String selector) {
223224
return new ClientInterceptor() {
224225
@Override
225226
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
226-
MethodDescriptor<ReqT, RespT> method,
227-
CallOptions callOptions,
228-
Channel next) {
227+
MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
229228
return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
230229
next.newCall(method, callOptions)) {
231230
@Override
232231
public void start(Listener<RespT> responseListener, Metadata headers) {
233-
headers.put(
234-
Metadata.Key.of("flagd-selector", Metadata.ASCII_STRING_MARSHALLER),
235-
selector);
232+
headers.put(FLAGD_SELECTOR_KEY, selector);
236233
super.start(responseListener, headers);
237234
}
238235
};

0 commit comments

Comments
 (0)