Skip to content

Commit 92c093d

Browse files
committed
chore: Ensure transition to falling back state based on synchronizer failure.
1 parent 3fa0a29 commit 92c093d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkgs/sdk/server/src/Internal/FDv2DataSources/FDv2DataSource.InitializationTracker.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,16 @@ public void UpdateStatus(DataSourceState newState, DataSourceStatus.ErrorInfo? n
254254
}
255255
case DataSourceCategory.Synchronizers when newState == DataSourceState.Off:
256256
{
257+
// Currently, FDv1 fallback happens in the synchronizers group. If something from that group
258+
// reports Off, with a reason indicating that it should fallback to v1, then we can
259+
// transition to that state.
260+
if (newError.HasValue && newError.Value.FDv1Fallback)
261+
{
262+
DetermineState(Action.FallingBack);
263+
}
264+
257265
DetermineState(Action.SynchronizersExhausted);
266+
258267
break;
259268
}
260269
case DataSourceCategory.FallbackSynchronizers when newState == DataSourceState.Off:
@@ -264,6 +273,8 @@ public void UpdateStatus(DataSourceState newState, DataSourceStatus.ErrorInfo? n
264273
}
265274
case DataSourceCategory.FallbackSynchronizers when newState == DataSourceState.Initializing:
266275
{
276+
// In the normal flow this will have be already handled via the `Off` state of the
277+
// synchronizers. This is purely redundant in the current implementation.
267278
DetermineState(Action.FallingBack);
268279
break;
269280
}

0 commit comments

Comments
 (0)