@@ -136,16 +136,16 @@ def _get_secret_key() -> str:
136
136
SECRET_KEY = _get_secret_key ()
137
137
138
138
139
- def _get_debug ( ) -> bool :
140
- debug = settings .get ("DEBUG" , False )
141
- if isinstance (debug , str ):
142
- debug = str_to_bool (debug )
143
- if not isinstance (debug , bool ):
144
- raise ImproperlyConfigured ("DEBUG setting must be a boolean value." )
145
- return debug
139
+ def _get_boolean ( name : str , default = False ) -> bool :
140
+ value = settings .get (name , default )
141
+ if isinstance (value , str ):
142
+ value = str_to_bool (value )
143
+ if not isinstance (value , bool ):
144
+ raise ImproperlyConfigured ("{name} setting must be a boolean value." )
145
+ return value
146
146
147
147
148
- DEBUG = _get_debug ( )
148
+ DEBUG = _get_boolean ( "DEBUG" )
149
149
150
150
ALLOWED_HOSTS = settings .get ("ALLOWED_HOSTS" , [])
151
151
ALLOWED_HOSTS = (
@@ -448,7 +448,14 @@ def rq_redis_client_instantiation_parameters():
448
448
if REDIS_HA_CLUSTER_HOSTS :
449
449
params ["mode" ] = "cluster"
450
450
params ["redis_hosts" ] = REDIS_HA_CLUSTER_HOSTS
451
-
451
+ params ["socket_keepalive" ] = _get_boolean ("MQ_SOCKET_KEEP_ALIVE" , True )
452
+ params ["socket_connect_timeout" ] = settings .get (
453
+ "MQ_SOCKET_CONNECT_TIMEOUT" , 10
454
+ )
455
+ params ["socket_timeout" ] = settings .get ("MQ_SOCKET_TIMEOUT" , 10 )
456
+ params ["cluster_error_retry_attempts" ] = settings .get (
457
+ "MQ_CLUSTER_ERROR_RETRY_ATTEMPTS" , 3
458
+ )
452
459
return params
453
460
454
461
0 commit comments