HaoTien commented on PR #12765: URL: https://github.com/apache/apisix/pull/12765#issuecomment-4071849640
Hi @moonming , thank you for your review! Let me address your questions: 1. Confirmation of Addressed Review Comments Yes, all previous review comments from @Baoyuantop and @Copilot have been addressed: ✅ Added test cases for sliding window expiration statistics reset (TEST 17) ✅ Added test cases for half-open state failure fallback (TEST 19) ✅ Added test cases for exceeding half_open_max_calls limit in half-open state (TEST 21) ✅ Fixed lint errors and code style issues ✅ Added comments explaining floating-point precision handling (4 decimal places) ✅ Removed unnecessary formatting changes 2. Summary of Final Design Decisions Through the extensive review process, the following key design decisions were made: Circuit Breaker States: CLOSED → OPEN: Triggered when error rate exceeds error_ratio threshold with minimum min_request_threshold requests OPEN → HALF_OPEN: After max_breaker_sec timeout, transitions to half-open state for testing HALF_OPEN → CLOSED: When success rate meets success_ratio threshold HALF_OPEN → OPEN: Immediately on any failure during half-open state Key Implementation Decisions: Uses sliding window (sliding_window_size) for statistics collection, which resets after expiration Floating-point comparisons use 4 decimal places precision to avoid Lua floating-point issues Atomic operations for state transitions to prevent race conditions Full backward compatibility with existing unhealthy-count policy (default behavior unchanged) 3. Documentation Coverage Both English and Chinese documentation have been updated to clearly explain both policies: The unhealthy-count policy (default) triggers based on consecutive failure counts The new unhealthy-ratio policy triggers based on error rate within a sliding window Each policy has its own dedicated section with: Configuration attributes table State transition descriptions Working examples The documentation includes a clear note section explaining the differences between the two policies. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
