Skip to content

Commit 9520c16

Browse files
author
jizhuozhi.george
committed
avoid NaN
1 parent 87efc57 commit 9520c16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rootfs/etc/nginx/lua/balancer/ewma.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ local function get_or_update_ewma(upstream, rtt, failed, update)
130130

131131
unlock()
132132

133-
local success_rate = 1 - failed_ewma / total_ewma
133+
local success_rate = 1 - failed_ewma / (total_ewma+1)
134134

135135
if success_rate < MIN_SUCCESS_RATE then
136136
success_rate = MIN_SUCCESS_RATE

0 commit comments

Comments
 (0)