Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2cdabe6
refactor: Check FDv2 fallback and recovery deadlines in the synchroni…
beekld Nov 6, 2026
81c8727
feat: Park failed FDv2 synchronizers and retry them after a backoff
beekld Nov 6, 2026
e1d3fd0
feat: Fall back or recover only to an FDv2 synchronizer that is not p…
beekld Nov 6, 2026
d862b8e
feat: End the FDv1 fallback after a TTL and restart the FDv2 synchron…
beekld Nov 6, 2026
8ea93fc
feat: Reset an FDv2 synchronizer's backoff when it meets its reset th…
beekld Nov 6, 2026
6c08a52
feat: Report the reset threshold from the FDv2 polling synchronizer
beekld Nov 6, 2026
046a448
feat: Report the reset threshold from the FDv2 streaming synchronizer
beekld Nov 6, 2026
f69369f
feat: Report the reset threshold from the FDv1 fallback synchronizer
beekld Nov 6, 2026
9a872c9
fix: Treat an exception on the FDv2 stream thread as terminal
beekld Nov 6, 2026
1171eca
test: Queue only new FDv2 data source states and errors in the mock sink
beekld Nov 6, 2026
919060d
fix: Signal FDv2 readiness on an initializer's FDv1 directive only wh…
beekld Nov 6, 2026
473cf44
docs: Mark FDv2SourceResult as not stable and in early access
beekld Nov 6, 2026
c2788f3
test: Do not wait for identify while FDv2 polling keeps failing
beekld Nov 12, 2026
d71b4b7
fix: Do not record an FDv2 INTERRUPTED status with no error as a succ…
beekld Nov 12, 2026
037044d
fix: Keep synchronizing when closing a source throws a runtime exception
beekld Nov 13, 2026
18ca8f6
fix: End the synchronizer wait when the FDv2 data source stops
beekld Nov 13, 2026
4f14c89
fix: Cancel the streaming reset threshold timer on a failure that kee…
beekld Nov 13, 2026
d6a96cc
fix: Measure the streaming reset threshold across ping-triggered polls
beekld Nov 13, 2026
48ce93c
fix: Report an error when an FDv2 synchronizer shuts down by itself
beekld Nov 13, 2026
ad65e07
fix: Record an FDv2 INTERRUPTED status with no error as a failure if …
beekld Nov 13, 2026
cf7d771
fix: Wait in nanoseconds while every FDv2 synchronizer is parked
beekld Nov 13, 2026
23206ec
docs: Update FDv2 comments that no longer match the code
beekld Nov 13, 2026
a164107
test: Rewrite FDv2 fallback and recovery tests that could not fail, a…
beekld Nov 13, 2026
afb16fa
test: Cover an FDv2 synchronizer that is still parked when the FDv1 f…
beekld Nov 13, 2026
843447f
test: Widen the timing margin in the FDv1 fallback TTL extension test
beekld Nov 13, 2026
81c3ae7
fix: Cancel the streaming reset threshold timer before queuing a failure
beekld Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ public void identifyWhenDataSystemPollingFailsAndCacheAlreadyExists() throws Exc
assertFalse("client was offline", client.isOffline());
assertEquals(flagValueA, client.stringVariation(flagKeyA, "defaultA"));

client.identify(contextB).get();
// Polling keeps failing, so identify never completes. Waiting for it would mean waiting for a timeout.
// Instead, this depends on identify applying the cached flags for contextB before it returns.
client.identify(contextB);
assertEquals(flagValueB, client.stringVariation(flagKeyB, "defaultB"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class ConnectivityManager implements ContextDataManager.ContextSwitchListener {
// A new instance is created for each data source, using the view that was current at the time.
private class DataSourceUpdateSinkImpl implements DataSourceUpdateSink, DataSourceUpdateSinkV2 {
private final ContextDataManager.ContextDataManagerView view;
// True if the last FDv2 status that this sink recorded was a failure.
private boolean failed;

DataSourceUpdateSinkImpl(ContextDataManager.ContextDataManagerView view) {
this.view = view;
Expand Down Expand Up @@ -127,9 +129,18 @@ public void setStatus(@NonNull DataSourceState state, Throwable failure) {
if (publicMode == null) {
return;
}
if (state == DataSourceState.INTERRUPTED && failure == null) {
if (failed) {
// Keep the error that is already recorded.
return;
}
failure = new LDFailure("Data source interrupted", LDFailure.FailureType.UNKNOWN_ERROR);
}
if (failure == null) {
failed = false;
updateConnectionInfoForSuccess(publicMode);
} else {
failed = true;
updateConnectionInfoForError(publicMode, failure);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ public Synchronizer build(DataSourceBuildInputs inputs) {
StandardEndpoints.FDV2_STREAMING_REQUEST_BASE_PATH,
requestor,
initialReconnectDelayMillis,
FDv2StreamingSynchronizer.RESET_THRESHOLD_MILLIS,
inputs.isEvaluationReasons(), inputs.getHttp().shouldUsePost(),
httpProps, inputs.getSharedExecutor(),
httpProps, inputs.getSharedExecutor(), inputs.getSharedExecutor(),
inputs.getBaseLogger(), null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
* objects so it can be used as a drop-in synchronizer within the FDv2 data source pipeline.
*/
final class FDv1PollingSynchronizer implements Synchronizer {
/**
* The number of consecutive successful polls that meets the reset threshold, the same as for an FDv2 polling
* synchronizer.
*/
private static final int RESET_THRESHOLD_SUCCESSFUL_POLLS = 2;

private final LDContext evaluationContext;
private final FeatureFetcher fetcher;
Expand All @@ -42,6 +47,12 @@ final class FDv1PollingSynchronizer implements Synchronizer {
private volatile ScheduledFuture<?> scheduledTask;
private final Object taskLock = new Object();

/**
* Only {@link #pollAndEnqueue()} reads or writes this. {@code scheduleWithFixedDelay} never starts a run of
* {@code pollAndEnqueue} before the previous run has finished.
*/
private int consecutiveSuccessfulPolls = 0;

/**
* @param evaluationContext the context to evaluate flags for
* @param fetcher the HTTP transport for FDv1 polling requests
Expand Down Expand Up @@ -74,8 +85,18 @@ private void pollAndEnqueue() {
try {
FDv2SourceResult result = doPoll();

if (result.getResultType() == SourceResultType.CHANGE_SET) {
consecutiveSuccessfulPolls++;
if (consecutiveSuccessfulPolls == RESET_THRESHOLD_SUCCESSFUL_POLLS) {
result = result.withResetThresholdMet();
}
}

if (result.getResultType() == SourceResultType.STATUS) {
FDv2SourceResult.Status status = result.getStatus();
if (status != null && status.getState() == SourceSignal.INTERRUPTED) {
consecutiveSuccessfulPolls = 0;
}
if (status != null && status.getState() == SourceSignal.TERMINAL_ERROR) {
synchronized (taskLock) {
if (scheduledTask != null) {
Expand All @@ -91,6 +112,7 @@ private void pollAndEnqueue() {
resultQueue.put(result);
} catch (RuntimeException e) {
LDUtil.logExceptionAtErrorLevel(logger, e, "Unexpected exception in FDv1 polling synchronizer task");
consecutiveSuccessfulPolls = 0;
resultQueue.put(FDv2SourceResult.status(FDv2SourceResult.Status.interrupted(e), false));
}
}
Expand Down
Loading
Loading