Skip to content

Commit cee26bb

Browse files
authored
technically incorrect (#321)
1 parent 9f37067 commit cee26bb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

posthog/client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,15 +1814,15 @@ def get_all_flags_and_payloads(
18141814
)
18151815
)
18161816

1817-
response, fallback_to_decide = self._get_all_flags_and_payloads_locally(
1817+
response, fallback_to_flags = self._get_all_flags_and_payloads_locally(
18181818
distinct_id,
18191819
groups=groups,
18201820
person_properties=person_properties,
18211821
group_properties=group_properties,
18221822
flag_keys_to_evaluate=flag_keys_to_evaluate,
18231823
)
18241824

1825-
if fallback_to_decide and not only_evaluate_locally:
1825+
if fallback_to_flags and not only_evaluate_locally:
18261826
try:
18271827
decide_response = self.get_flags_decision(
18281828
distinct_id,
@@ -1858,7 +1858,7 @@ def _get_all_flags_and_payloads_locally(
18581858

18591859
flags: dict[str, FlagValue] = {}
18601860
payloads: dict[str, str] = {}
1861-
fallback_to_decide = False
1861+
fallback_to_flags = False
18621862
# If loading in previous line failed
18631863
if self.feature_flags:
18641864
# Filter flags based on flag_keys_to_evaluate if provided
@@ -1886,19 +1886,19 @@ def _get_all_flags_and_payloads_locally(
18861886
payloads[flag["key"]] = matched_payload
18871887
except InconclusiveMatchError:
18881888
# No need to log this, since it's just telling us to fall back to `/flags`
1889-
fallback_to_decide = True
1889+
fallback_to_flags = True
18901890
except Exception as e:
18911891
self.log.exception(
18921892
f"[FEATURE FLAGS] Error while computing variant and payload: {e}"
18931893
)
1894-
fallback_to_decide = True
1894+
fallback_to_flags = True
18951895
else:
1896-
fallback_to_decide = True
1896+
fallback_to_flags = True
18971897

18981898
return {
18991899
"featureFlags": flags,
19001900
"featureFlagPayloads": payloads,
1901-
}, fallback_to_decide
1901+
}, fallback_to_flags
19021902

19031903
def _initialize_flag_cache(self, cache_url):
19041904
"""Initialize feature flag cache for graceful degradation during service outages.

posthog/test/test_feature_flags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def test_flag_with_complex_definition(self, patch_get, patch_flags):
365365

366366
@mock.patch("posthog.client.flags")
367367
@mock.patch("posthog.client.get")
368-
def test_feature_flags_fallback_to_decide(self, patch_get, patch_flags):
368+
def test_feature_flags_fallback_to_flags(self, patch_get, patch_flags):
369369
patch_flags.return_value = {
370370
"featureFlags": {"beta-feature": "alakazam", "beta-feature2": "alakazam2"}
371371
}
@@ -431,7 +431,7 @@ def test_feature_flags_fallback_to_decide(self, patch_get, patch_flags):
431431

432432
@mock.patch("posthog.client.flags")
433433
@mock.patch("posthog.client.get")
434-
def test_feature_flags_dont_fallback_to_decide_when_only_local_evaluation_is_true(
434+
def test_feature_flags_dont_fallback_to_flags_when_only_local_evaluation_is_true(
435435
self, patch_get, patch_flags
436436
):
437437
patch_flags.return_value = {

0 commit comments

Comments
 (0)