@@ -592,6 +592,8 @@ def __init__(
592
592
self ,
593
593
db = 0 ,
594
594
password = None ,
595
+ socket_timeout = None ,
596
+ socket_connect_timeout = None ,
595
597
retry_on_timeout = False ,
596
598
retry_on_error = SENTINEL ,
597
599
encoding = "utf-8" ,
@@ -627,6 +629,10 @@ def __init__(
627
629
self .credential_provider = credential_provider
628
630
self .password = password
629
631
self .username = username
632
+ self .socket_timeout = socket_timeout
633
+ if socket_connect_timeout is None :
634
+ socket_connect_timeout = socket_timeout
635
+ self .socket_connect_timeout = socket_connect_timeout
630
636
self .retry_on_timeout = retry_on_timeout
631
637
if retry_on_error is SENTINEL :
632
638
retry_on_error = []
@@ -927,17 +933,13 @@ def __init__(
927
933
self ,
928
934
host = "localhost" ,
929
935
port = 6379 ,
930
- socket_timeout = None ,
931
- socket_connect_timeout = None ,
932
936
socket_keepalive = False ,
933
937
socket_keepalive_options = None ,
934
938
socket_type = 0 ,
935
939
** kwargs ,
936
940
):
937
941
self .host = host
938
942
self .port = int (port )
939
- self .socket_timeout = socket_timeout
940
- self .socket_connect_timeout = socket_connect_timeout or socket_timeout
941
943
self .socket_keepalive = socket_keepalive
942
944
self .socket_keepalive_options = socket_keepalive_options or {}
943
945
self .socket_type = socket_type
@@ -1158,9 +1160,8 @@ def _connect(self):
1158
1160
class UnixDomainSocketConnection (AbstractConnection ):
1159
1161
"Manages UDS communication to and from a Redis server"
1160
1162
1161
- def __init__ (self , path = "" , socket_timeout = None , ** kwargs ):
1163
+ def __init__ (self , path = "" , ** kwargs ):
1162
1164
self .path = path
1163
- self .socket_timeout = socket_timeout
1164
1165
super ().__init__ (** kwargs )
1165
1166
1166
1167
def repr_pieces (self ):
@@ -1172,8 +1173,9 @@ def repr_pieces(self):
1172
1173
def _connect (self ):
1173
1174
"Create a Unix domain socket connection"
1174
1175
sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
1175
- sock .settimeout (self .socket_timeout )
1176
+ sock .settimeout (self .socket_connect_timeout )
1176
1177
sock .connect (self .path )
1178
+ sock .settimeout (self .socket_timeout )
1177
1179
return sock
1178
1180
1179
1181
def _host_error (self ):
0 commit comments