diff --git a/rootfs/etc/nginx/lua/balancer/ewma.lua b/rootfs/etc/nginx/lua/balancer/ewma.lua index 641b5e0b7..05aae2a77 100644 --- a/rootfs/etc/nginx/lua/balancer/ewma.lua +++ b/rootfs/etc/nginx/lua/balancer/ewma.lua @@ -78,15 +78,15 @@ end function _M.balance(self) local peers = self.peers - local endpoint, score = peers[1], -1 + local endpoint, ewma_score = peers[1], -1 if #peers > 1 then local k = (#peers < PICK_SET_SIZE) and #peers or PICK_SET_SIZE local peer_copy = util.deepcopy(peers) - endpoint, score = pick_and_score(self, peer_copy, k) + endpoint, ewma_score = pick_and_score(self, peer_copy, k) end - ngx.var.balancer_ewma_score = score + ngx.var.balancer_ewma_score = ewma_score -- TODO(elvinefendi) move this processing to _M.sync return endpoint.address .. ":" .. endpoint.port diff --git a/rootfs/etc/nginx/lua/balancer/sticky.lua b/rootfs/etc/nginx/lua/balancer/sticky.lua index 4860c75a3..6f0aef2a9 100644 --- a/rootfs/etc/nginx/lua/balancer/sticky.lua +++ b/rootfs/etc/nginx/lua/balancer/sticky.lua @@ -132,13 +132,16 @@ function _M.balance(self) end local last_failure = self.get_last_failure() - local should_pick_new_upstream = last_failure ~= nil and self.cookie_session_affinity.change_on_failure or upstream_from_cookie == nil + local should_pick_new_upstream = last_failure ~= nil and self.cookie_session_affinity.change_on_failure or + upstream_from_cookie == nil if not should_pick_new_upstream then return upstream_from_cookie end - local new_upstream, key = pick_new_upstream(self) + local new_upstream + + new_upstream, key = pick_new_upstream(self) if not new_upstream then ngx.log(ngx.WARN, string.format("failed to get new upstream; using upstream %s", new_upstream)) elseif should_set_cookie(self) then diff --git a/rootfs/etc/nginx/lua/configuration.lua b/rootfs/etc/nginx/lua/configuration.lua index 3d9e1bdcf..48d61d83d 100644 --- a/rootfs/etc/nginx/lua/configuration.lua +++ b/rootfs/etc/nginx/lua/configuration.lua @@ -59,13 +59,14 @@ local function handle_servers() local err_buf = {} for _, server in ipairs(servers) do if server.hostname and server.sslCert.pemCertKey then - local success, err, forcible = certificate_data:set(server.hostname, server.sslCert.pemCertKey) + local success, set_err, forcible = certificate_data:set(server.hostname, server.sslCert.pemCertKey) if not success then - local err_msg = string.format("error setting certificate for %s: %s\n", server.hostname, tostring(err)) + local err_msg = string.format("error setting certificate for %s: %s\n", server.hostname, tostring(set_err)) table.insert(err_buf, err_msg) end if forcible then - local msg = string.format("certificate_data dictionary is full, LRU entry has been removed to store %s", server.hostname) + local msg = string.format("certificate_data dictionary is full, LRU entry has been removed to store %s", + server.hostname) ngx.log(ngx.WARN, msg) end else