Skip to content

Commit 2b93187

Browse files
authored
Merge pull request #11 from tangwz/master
try_hosts's connect_to_host(host) no need select(db).
2 parents 12e20b4 + 6734d96 commit 2b93187

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/resty/redis/connector.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ local sentinel = require "resty.redis.sentinel"
44

55

66
local ipairs, setmetatable, pcall = ipairs, setmetatable, pcall
7-
local ngx_null = ngx.null
87
local ngx_log = ngx.log
9-
local ngx_DEBUG = ngx.DEBUG
108
local ngx_ERR = ngx.ERR
119
local ngx_re_match = ngx.re.match
12-
local tbl_insert = table.insert
1310
local tbl_remove = table.remove
1411
local tbl_sort = table.sort
1512

@@ -235,7 +232,9 @@ function _M.connect_to_host(self, host)
235232
end
236233
end
237234

238-
r:select(host.db)
235+
if host.db ~= nil then
236+
r:select(host.db)
237+
end
239238
return r, nil
240239
end
241240
end

0 commit comments

Comments
 (0)