Skip to content

Commit

Permalink
Remove force sync / 30s for non-external backends (kubernetes#7958)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZxYuan authored and rchshld committed May 17, 2023
1 parent b8e25f5 commit 6853a32
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions rootfs/etc/nginx/lua/balancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local ngx = ngx
-- it will take <the delay until controller POSTed the backend object to the
-- Nginx endpoint> + BACKENDS_SYNC_INTERVAL
local BACKENDS_SYNC_INTERVAL = 1
local BACKENDS_FORCE_SYNC_INTERVAL = 30

local DEFAULT_LB_ALG = "round_robin"
local IMPLEMENTATIONS = {
Expand Down Expand Up @@ -146,10 +145,7 @@ end

local function sync_backends()
local raw_backends_last_synced_at = configuration.get_raw_backends_last_synced_at()
ngx.update_time()
local current_timestamp = ngx.time()
if current_timestamp - backends_last_synced_at < BACKENDS_FORCE_SYNC_INTERVAL
and raw_backends_last_synced_at <= backends_last_synced_at then
if raw_backends_last_synced_at <= backends_last_synced_at then
return
end

Expand Down

0 comments on commit 6853a32

Please sign in to comment.