You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f8ace1a
Browse filesBrowse the repository at this point in the historyBrowse files
fix: Ask the override layer for the key before the client has LaunchDarkly data
Before initialization the clients consult the override layer directly. A flag the layer does not hold gets the not-ready handling it had without an override source, for an invalid context, a store outage, and an uninitialized persistent store alike. The all-flags state is unavailable when the layer is empty. The sync client stops the components it started when the data system fails to start.
log.warning("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: "+key+". This message is logged once.")
515
-
elifself._data_system.override_source_configured:
516
-
# No data from LaunchDarkly is available. The store read below still finds an
517
-
# entry that the override layer holds, and the SDK serves it. A miss returns the
518
-
# not-ready default.
519
-
no_launchdarkly_data=True
520
515
else:
521
-
returnnot_ready()
516
+
# No data from LaunchDarkly is available. A flag that the override layer holds
517
+
# is served anyway. A flag the layer does not hold gets the not-ready default,
518
+
# as it does without an override source.
519
+
layer=self._data_system.override_layer
520
+
iflayerisnotNone:
521
+
flag=layer.get(FEATURES, key)
522
+
ifflagisNone:
523
+
returnnot_ready()
522
524
523
525
ifnotcontext.valid:
524
526
log.warning("Context was invalid for flag evaluation (%s); returning default value"%context.error)
log.warning("all_flags_state() called before client has finished initializing! Using last known values from feature store. This message is logged once.")
594
-
elifself._data_system.override_source_configured:
595
-
# No data from LaunchDarkly is available. The store read below returns only the
596
-
# entries that the override layer holds. The result decides the state.
597
-
overrides_only=True
598
595
else:
599
-
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
600
-
returnFeatureFlagsState(False)
596
+
# No data from LaunchDarkly is available. When the override layer holds entries,
597
+
# the state is built from them alone. Otherwise the state is unavailable, as it
598
+
# is without an override source.
599
+
layer=self._data_system.override_layer
600
+
iflayerisNoneorlayer.is_empty:
601
+
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
602
+
returnFeatureFlagsState(False)
603
+
overrides_only=True
601
604
602
605
ifnotcontext.valid:
603
606
log.warning("Context was invalid for all_flags_state (%s); returning default value"%context.error)
log.warning("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: "+key+". This message is logged once.")
486
-
elifself._data_system.override_source_configured:
487
-
# No data from LaunchDarkly is available. The store read below still finds an
488
-
# entry that the override layer holds, and the SDK serves it. A miss returns the
489
-
# not-ready default.
490
-
no_launchdarkly_data=True
491
501
else:
492
-
returnnot_ready()
502
+
# No data from LaunchDarkly is available. A flag that the override layer holds
503
+
# is served anyway. A flag the layer does not hold gets the not-ready default,
504
+
# as it does without an override source.
505
+
layer=self._data_system.override_layer
506
+
iflayerisnotNone:
507
+
flag=layer.get(FEATURES, key)
508
+
ifflagisNone:
509
+
returnnot_ready()
493
510
494
511
ifnotcontext.valid:
495
512
log.warning("Context was invalid for flag evaluation (%s); returning default value"%context.error)
log.warning("all_flags_state() called before client has finished initializing! Using last known values from feature store. This message is logged once.")
569
-
elifself._data_system.override_source_configured:
570
-
# No data from LaunchDarkly is available. The store read below returns only the
571
-
# entries that the override layer holds. The result decides the state.
572
-
overrides_only=True
573
585
else:
574
-
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
575
-
returnFeatureFlagsState(False)
586
+
# No data from LaunchDarkly is available. When the override layer holds entries,
587
+
# the state is built from them alone. Otherwise the state is unavailable, as it
588
+
# is without an override source.
589
+
layer=self._data_system.override_layer
590
+
iflayerisNoneorlayer.is_empty:
591
+
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
592
+
returnFeatureFlagsState(False)
593
+
overrides_only=True
576
594
577
595
ifnotcontext.valid:
578
596
log.warning("Context was invalid for all_flags_state (%s); returning default value"%context.error)
0 commit comments