Skip to content

Commit ebaa82e

Browse files
committed
avoid double field lookup
1 parent 918543e commit ebaa82e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/resty/redis/connector.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ function _M.connect_to_host(self, host)
226226
else
227227
r:set_timeout(self, self.read_timeout)
228228

229-
if host.password then
230-
local res, err = r:auth(host.password)
229+
local password = host.password
230+
if password then
231+
local res, err = r:auth(password)
231232
if err then
232233
ngx_log(ngx_ERR, err)
233234
return res, err

0 commit comments

Comments
 (0)