Repository navigation
Conversation
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
| return interrupted(errorInfo, fdv1Fallback, null, completionCallback); | ||
| } | ||
|
|
||
| public static FDv2SourceResult interrupted(DataSourceStatusProvider.ErrorInfo errorInfo, boolean fdv1Fallback, Duration fdv1FallbackTTL, Function<Void, Void> completionCallback) { |
There was a problem hiding this comment.
I think a more future-proof design might be to replace boolean fdv1Fallback, Duration fdv1FallbackTT with a new nullable FDv1Fallback object that contains a Duration ttl. That way, if the format changes in the future, we don't have to change all the interfaces.
There was a problem hiding this comment.
Done in 71beeaa. There's a new datasources.FDv1Fallback, holding a nullable Duration ttl. The FDv2SourceResult factories now take a nullable FDv1Fallback in place of the boolean, where null means no directive, so the extra TTL overloads are gone. getFdv1Fallback() returns the directive, and isFdv1Fallback() remains as a != null shorthand.
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Requirements
Related issues
Closes SDK-2987. Follows #265 and #273, the goodbye TTL parsing in
java-sdk-internal1.13.1. Spec: DATASYSTEM 1.6 (sdk-specs#251).Describe the solution you've provided
Previously the server SDK always used the jittered 1h default as the FDv1 fallback TTL. It now uses the TTL the server sends.
X-LD-FD-Fallback-TTLfrom the response that carriesX-LD-FD-Fallback, for both polling and streaming.goodbyethat hasprotocolFallbackTTLis now itself a fallback directive, and its TTL takes precedence over the header's.(0, 1h]is used as-is, with no jitter. A missing, malformed, zero, negative, or >1h TTL uses the jittered 1h default.FDv2SourceResult(experimental package) now carries a nullableFDv1Fallbackdirective, with a nullablegetTtl(), in place of theboolean fdv1Fallback.Implementation details
launchdarklyJavaSdkInternalfrom 1.13.0 to 1.13.1, which providesFDv2ActionGoodbye.getProtocolFallbackTTLMillis().HeaderConstants. A non-integer value gives a directive with a null TTL, which means the default.(0, 1h]check and the jitter live in one place,FDv2DataSource.fallbackTTL(Duration).InitializerOutcomenow carries the directive.false(file data source,TestDataV2,DataSourceSynchronizerAdapter) now passnull../gradlew test checkstyleMain checkstyleTestpasses inlib/sdk/server.Link to Devin session: https://app.devin.ai/sessions/cce64c67519f4babaa75176c06961c5e
Open in Devin Desktop: https://app.devin.ai/desktop/session/cce64c67519f4babaa75176c06961c5e?variant=devin
Requested by: @beekld