Repository navigation
Conversation
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes the server SDK's FDv1 fallback TTL-based, per sdk-specs#251. Fallback is never permanent: FDv2 is retried once the TTL elapses.
Closes SDK-2983 for the server side (part of SDK-2935). Client side is covered by #1982 / #1875. Stacked on #1982 to reuse its
resolveFallbackTtlMs, so retarget tomainonce that merges.X-LD-FD-Fallback-TTLis now honored. A TTL in (0, 3600]s is used as-is. Missing, malformed, zero, negative, or > 3600 becomes a jittered default in [30min, 1h].CompositeDataSourcekeeps its FDv2 synchronizers while on FDv1 and restores them after the TTL. This also applies with no FDv1 synchronizer (fdv1Fallback: null): the data source waits out the TTL and retries FDv2 instead of terminating withClosed.goodbye.protocolFallbackTTLas a fallback signal (it never did, and it reads headers). Contract tests are unchanged because the harness doesn't cover fallback TTL/recovery.Implementation details
Requirements
Mechanism
RequestorandStreamingProcessorFDv2parse the directive with the sharedinternal.readFallbackDirectiveinstead of checking onlyx-ld-fd-fallback.LDFlagDeliveryFallbackError.fdv1FallbackTtlMs, an optional fourth constructor argument. It also travels on the payload marker asfdv1FallbackTtlMsnext tofallbackToFDv1.LDFeatureRequestor's callback gets an optional fifth argument for it.CompositeDataSourceschedules a cancellable recovery timer when fallback engages. The main loop races that timer with the current source's transitions and external stop. When the timer fires, the composite restores the FDv2 list, clears the engaged flag, and does aswitchToSync. When no FDv1 source is available, the loop waits on the timer instead of resolvingstop.LDFlagDeliveryFallbackErrorisrecoverable: false. The composite previously culled the reporting FDv2 factory before engaging fallback. The fallback check now runs first. Later fallback errors from FDv1 sources are still culled and throttled as before.Testing
Requestor: valid TTL headers (1, 500, 3600) pass through unchanged. Missing,0,-5,3601, andabcgive a value in [30min, 1h].StreamingProcessorFDv2: the open-header TTL is attached to the payload marker.CompositeDataSource: FDv2 is retried after the TTL with no FDv1 synchronizer (replaces the old "terminates" test). FDv1 is stopped before FDv2 restarts (event-order assertion). The FDv1 retry-throttling test now ends on a valid FDv1 source, because exhausting FDv1 sources no longer terminates the data source.js-sdk-commonandjs-server-sdk-commonunit tests, lint, format check, and build all pass.Reference implementation: cpp-sdks#631.
Link to Devin session: https://app.devin.ai/sessions/70626b2e151142fd9c4fbbedd01d08df
Open in Devin Desktop: https://app.devin.ai/desktop/session/70626b2e151142fd9c4fbbedd01d08df?variant=devin
Requested by: @beekld