This is an automated email from the ASF dual-hosted git repository.
ashishtiwari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new fa1ab6e4e fix(api-breaker): inconsistent circuit breaking due to
premature breaker_time increment (#12451)
fa1ab6e4e is described below
commit fa1ab6e4e5daedc143bcbf6202b59b609b0f0df7
Author: Ashish Tiwari <[email protected]>
AuthorDate: Mon Jul 21 22:03:37 2025 +0530
fix(api-breaker): inconsistent circuit breaking due to premature
breaker_time increment (#12451)
---
apisix/plugins/api-breaker.lua | 2 +-
t/plugin/api-breaker.t | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/apisix/plugins/api-breaker.lua b/apisix/plugins/api-breaker.lua
index eabca140a..440f0ee60 100644
--- a/apisix/plugins/api-breaker.lua
+++ b/apisix/plugins/api-breaker.lua
@@ -166,7 +166,7 @@ function _M.access(conf, ctx)
return
end
- local failure_times = math.ceil(unhealthy_count / conf.unhealthy.failures)
+ local failure_times = math.floor(unhealthy_count / conf.unhealthy.failures)
if failure_times < 1 then
failure_times = 1
end
diff --git a/t/plugin/api-breaker.t b/t/plugin/api-breaker.t
index 280bf01d7..04e09a9c7 100644
--- a/t/plugin/api-breaker.t
+++ b/t/plugin/api-breaker.t
@@ -541,7 +541,7 @@ location /mysleep {
[
500, 500, 500, 502,
200, 200, 200,
- 500,502,502,502
+ 500,500,500,502
]