Skip to content

Commit f2d3304

Browse files
committed
refactor: mirror synchronizer-phase fallback pattern in initializer phase
Call sourceManager.fdv1Fallback() unconditionally when an initializer signals an FDv1 fallback directive, then let hasFDv1Fallback() govern logging and the continue-vs-halt decision -- matching the synchronizer-phase pattern introduced in 8cdf09d. Functionally a no-op: the no-fallback branch already returns from run() entirely, so the FDv2 synchronizers never get a chance to start. The unconditional call is safe (its block-others / unblock-fdv1 loop is a no-op when no FDv1 fallback is configured) and keeps the two phases symmetric.
1 parent 8cdf09d commit f2d3304

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ private void run() {
138138
initializerOutcome = runInitializers();
139139
}
140140

141-
// If an initializer signalled FDv1 fallback, switch to the FDv1 synchronizer
142-
// (if configured) or transition to OFF. This takes precedence over the standard
141+
// If an initializer signalled FDv1 fallback, block every FDv2 synchronizer in
142+
// one shot via fdv1Fallback() (which also unblocks the FDv1 fallback
143+
// synchronizer, if one is configured). If FDv1 is configured we hand off to it;
144+
// otherwise we halt the data system. This takes precedence over the standard
143145
// synchronizer chain -- the FDv2 synchronizers are not given a chance to run.
144146
if (initializerOutcome.fallbackToFDv1) {
147+
sourceManager.fdv1Fallback();
145148
if (sourceManager.hasFDv1Fallback()) {
146149
logger.warn("Initializer requested fallback to FDv1; switching to FDv1 fallback synchronizer.");
147-
sourceManager.fdv1Fallback();
148150
} else {
149151
logger.warn("Initializer requested fallback to FDv1, but no FDv1 fallback synchronizer is configured.");
150152
dataSourceUpdates.updateStatus(

0 commit comments

Comments
 (0)