Skip to content

Commit

Permalink
Break out of the loop when the key is found
Browse files Browse the repository at this point in the history
The purpose of the loop is to loop through the flag keys and evaluate the one where `flag["key"] == key`. Once that key is found, there's no need to continue the loop.
  • Loading branch information
haacked committed Jan 31, 2025
1 parent f8bf011 commit 3c7a46e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions posthog/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ def get_feature_flag(
except Exception as e:
self.log.exception(f"[FEATURE FLAGS] Error while computing variant locally: {e}")
continue
break

flag_was_locally_evaluated = response is not None
if not flag_was_locally_evaluated and not only_evaluate_locally:
Expand Down

0 comments on commit 3c7a46e

Please sign in to comment.