Merge pull request #4286 from Shopify/fix-lua-lints

fix lua lints
This commit is contained in:
Kubernetes Prow Robot 2019-07-08 11:22:36 -07:00 committed by GitHub
commit cc22aed52a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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