@@ -129,17 +129,17 @@ end
129129
130130
131131function _M .set_connect_timeout (self , timeout )
132- self .connect_timeout = timeout
132+ self .config . connect_timeout = timeout
133133end
134134
135135
136136function _M .set_read_timeout (self , timeout )
137- self .read_timeout = timeout
137+ self .config . read_timeout = timeout
138138end
139139
140140
141141function _M .set_connection_options (self , options )
142- self .connection_options = options
142+ self .config . connection_options = options
143143end
144144
145145
@@ -277,20 +277,21 @@ end
277277
278278function _M .connect_to_host (self , host )
279279 local r = redis .new ()
280- r :set_timeout (self .connect_timeout )
280+ local config = self .config
281+ r :set_timeout (config .connect_timeout )
281282
282283 local ok , err
283284 local socket = host .socket
284- local opts = self .connection_options
285+ local opts = config .connection_options
285286 if socket then
286287 if opts then
287- ok , err = r :connect (socket , self .connection_options )
288+ ok , err = r :connect (socket , config .connection_options )
288289 else
289290 ok , err = r :connect (socket )
290291 end
291292 else
292293 if opts then
293- ok , err = r :connect (host .host , host .port , self .connection_options )
294+ ok , err = r :connect (host .host , host .port , config .connection_options )
294295 else
295296 ok , err = r :connect (host .host , host .port )
296297 end
@@ -300,7 +301,7 @@ function _M.connect_to_host(self, host)
300301 ngx_log (ngx_ERR , err , " for " , host .host , " :" , host .port )
301302 return nil , err
302303 else
303- r :set_timeout (self , self .read_timeout )
304+ r :set_timeout (self , config .read_timeout )
304305
305306 local password = host .password
306307 if password and password ~= " " then
0 commit comments