Support a Client Readiness check in local evaluation mode

Đang mở
#197 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong flagsmith/flagsmith.py, xung quanh cơ chế remote fallback ở các dòng 252-259, sau đó lần theo quá trình khởi tạo, chế độ đánh giá cục bộ và get_environment_flags/get_identity_flags. Xác định và kiểm thử trạng thái sẵn sàng, đồng thời đảm bảo rằng khi thiếu tài liệu môi trường trong chế độ cục bộ, các flag mặc định được trả về mà không có các lệnh gọi remote trong mỗi lần đánh giá, trong khi background poller có thể phục hồi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
24
Fork
12
Merge trung bình
15 giờ 43 phút
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Flagsmith/flagsmith-python-client

Tất cả issue của Flagsmith/flagsmith-python-client

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.