File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 8989bucket_notification_kafka_offset_reset = os .environ .get ("BUCKET_NOTIFICATION_KAFKA_OFFSET_RESET" , "latest" )
9090# Max requests to handle before restarting. 0 means no limit.
9191max_requests = int (os .environ .get ("WORKER_RESTART_FREQ" , 0 ))
92+ # The number of seconds to delay retrying connections to the Redis stream.
93+ redis_retry = float (os .environ .get ("REDIS_RETRY_DELAY" , 30 ))
9294
9395# Conditionally load keda environment variables
9496if platform == "keda" :
@@ -234,7 +236,12 @@ def _make_redis_streams_client(self):
234236 redis_client : `redis.Redis`
235237 Initialized Redis client.
236238 """
237- return redis .Redis (host = self .host )
239+ policy = redis .retry .Retry (redis .backoff .ConstantBackoff (redis_retry ),
240+ 1 ,
241+ # Bare ConnectionError covers things like DNS problems
242+ (redis .exceptions .ConnectionError , ),
243+ )
244+ return redis .Redis (host = self .host , retry = policy )
238245
239246 @staticmethod
240247 def _close_on_error (func ):
You can’t perform that action at this time.
0 commit comments