Support a Client Readiness check in local evaluation mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
Research direction
Start in flagsmith/flagsmith.py around the remote fallback at lines 252-259, then trace initialization, local evaluation mode, and get_environment_flags/get_identity_flags. Define and test the readiness state and ensure a missing environment document in local mode returns default flags without per-evaluation remote calls while the background poller can recover.
Written by the indexing model from the issue text.
Description
Problem
Currently, when a Flagsmith client is initialized, it makes a blocking remote call to the Flagsmith endpoint to fetch the environment document. If this fetch fails, the exception is simply logged with an error message.
The issue arises during subsequent flag evaluations (get_environment_flags / get_identity_flags). If the initial fetch failed, the SDK defaults to fetching the flags via a remote API call.
This behavior is highly undesirable when the client is explicitly configured for local evaluation mode.
Systemic Impact
If the client is unable to fetch the environment document because the Flagsmith edge/proxy is experiencing high load or degradation, the default API fallback mechanism drastically worsens the situation. Instead of polling for the document occasionally, the client begins making a remote API call for every single flag evaluation. This creates a thundering herd effect, overwhelming the proxy and potentially causing a death spiral where the proxy can never recover to a healthy state. Also, now clients are no longer evaluating flags locally resulting in latencies in the call path.
Proposed Solution
We need a way to verify the client's state and prevent unwanted remote API spam.
Introduce a ready() API: The SDK should expose a ready() method (or an is_ready property) that developers can use to check for client readiness before proceeding with flag evaluations in the evaluation path.
Re-evaluate the Fallback Behavior: When in local evaluation mode, the SDK should ideally not fall back to remote API calls on a per-evaluation basis if the environment document is missing. Instead, it should return default flags and rely on the background poller to eventually fetch the document once the proxy recovers.
Expected Behavior
In local evaluation mode, a failure to fetch the initial environment document should not silently convert the client into a remote-evaluation client. Developers should be able to check if the local cache is populated and healthy via a ready() method.
- Dominant language
- Python
- Stars
- 24
- Forks
- 12
- Avg merge
- 15h 43m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Flagsmith/flagsmith-python-client
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Dependency Dashboard Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Flagsmith/flagsmith-python-client#198 · 1 comment · 2 assignees ·
All issues in Flagsmith/flagsmith-python-client
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100