Skip to content

Commit 8cdf09d

Browse files
committed
refactor: simplify synchronizer-phase FDv1 fallback halt path
Per PR #158 review feedback, sourceManager.fdv1Fallback() blocks every FDv2 synchronizer regardless of whether an FDv1 fallback is configured (the unblock-FDv1 loop is a no-op when none exists). Calling it unconditionally lets the subsequent hasFDv1Fallback() check focus on logging and control flow only -- hand off to FDv1 vs. halt with OFF. The halt branch's explicit blockCurrentSynchronizer() is now redundant (fdv1Fallback() already blocked the current sync along with the rest of the FDv2 chain) and was dropped. blockCurrentSynchronizer remains in use by the TERMINAL_ERROR branch. No behavior change.
1 parent 1b5bb14 commit 8cdf09d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/FDv2DataSource.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -449,26 +449,27 @@ private boolean runSynchronizers() {
449449
}
450450
break;
451451
}
452-
// We have been requested to fall back to FDv1. We handle whatever message was associated,
453-
// close the synchronizer, and then fallback. An FDv1 fallback synchronizer
454-
// requesting another fallback is ignored (shouldn't happen in practice).
452+
// We have been requested to fall back to FDv1. Block every FDv2
453+
// synchronizer in one shot via fdv1Fallback() (which also unblocks the
454+
// FDv1 fallback synchronizer, if one is configured). If FDv1 is
455+
// configured we hand off to it; otherwise we halt the data system.
456+
// An FDv1 fallback synchronizer asking to fall back again is ignored
457+
// -- shouldn't happen in practice.
455458
if (result.isFdv1Fallback()
456459
&& !sourceManager.isCurrentSynchronizerFDv1Fallback()) {
460+
sourceManager.fdv1Fallback();
457461
if (sourceManager.hasFDv1Fallback()) {
458-
sourceManager.fdv1Fallback();
459462
logger.info("Falling back to an FDv1 fallback synchronizer.");
460463
running = false;
461464
} else {
462465
// When the directive is signalled but no FDv1 fallback synchronizer
463-
// is configured, halt the data system entirely. Block the current
464-
// synchronizer so it cannot be selected again, surface OFF with the
465-
// most recent error info (if any), and exit the synchronizer loop
466-
// terminally.
466+
// is configured, halt the data system entirely. Surface OFF with
467+
// the most recent error info (if any) and exit the synchronizer
468+
// loop terminally.
467469
logger.warn(
468470
"Synchronizer '{}' requested FDv1 fallback, but no FDv1 fallback synchronizer is configured; halting the data system.",
469471
synchronizer.name()
470472
);
471-
sourceManager.blockCurrentSynchronizer();
472473
DataSourceStatusProvider.ErrorInfo offError =
473474
result.getStatus() != null ? result.getStatus().getErrorInfo() : null;
474475
dataSourceUpdates.updateStatus(

0 commit comments

Comments
 (0)