@@ -57,6 +57,7 @@ def __init__(self, server, params):
57
57
self .parser_class = self .get_parser_class ()
58
58
self .pickle_version = self .get_pickle_version ()
59
59
self .socket_timeout = self .get_socket_timeout ()
60
+ self .socket_connect_timeout = self .get_socket_connect_timeout ()
60
61
self .connection_pool_class = self .get_connection_pool_class ()
61
62
self .connection_pool_class_kwargs = (
62
63
self .get_connection_pool_class_kwargs ()
@@ -106,13 +107,21 @@ def get_pickle_version(self):
106
107
try :
107
108
return int (_pickle_version )
108
109
except (ValueError , TypeError ):
109
- raise ImproperlyConfigured ("pickle version value must be an integer" )
110
+ raise ImproperlyConfigured (
111
+ "pickle version value must be an integer"
112
+ )
110
113
111
114
def get_socket_timeout (self ):
112
115
return self .options .get ('SOCKET_TIMEOUT' , None )
113
116
117
+ def get_socket_connect_timeout (self ):
118
+ return self .options .get ('SOCKET_CONNECT_TIMEOUT' , None )
119
+
114
120
def get_connection_pool_class (self ):
115
- pool_class = self .options .get ('CONNECTION_POOL_CLASS' , 'redis.ConnectionPool' )
121
+ pool_class = self .options .get (
122
+ 'CONNECTION_POOL_CLASS' ,
123
+ 'redis.ConnectionPool'
124
+ )
116
125
return import_class (pool_class )
117
126
118
127
def get_connection_pool_class_kwargs (self ):
@@ -160,6 +169,7 @@ def create_client(self, server):
160
169
db = self .db ,
161
170
password = self .password ,
162
171
socket_timeout = self .socket_timeout ,
172
+ socket_connect_timeout = self .socket_connect_timeout ,
163
173
)
164
174
client = redis .Redis (** kwargs )
165
175
kwargs .update (
0 commit comments