updated redis impl

This commit is contained in:
2025-04-20 14:58:55 +03:00
parent cc19cb7e6d
commit 6ab4410a82
4 changed files with 264 additions and 6 deletions

View File

@@ -40,7 +40,19 @@ class RedisConn:
# Add connection pooling settings if not provided
if "max_connections" not in self.config:
self.config["max_connections"] = 10
self.config["max_connections"] = 50 # Increased for better concurrency
# Add connection timeout settings
if "health_check_interval" not in self.config:
self.config["health_check_interval"] = 30 # Health check every 30 seconds
# Add retry settings for operations
if "retry_on_timeout" not in self.config:
self.config["retry_on_timeout"] = True
# Add connection pool settings for better performance
if "socket_keepalive" not in self.config:
self.config["socket_keepalive"] = True
# Initialize the connection with retry logic
self._connect_with_retry()
@@ -124,7 +136,10 @@ class RedisConn:
"socket_connect_timeout", self.DEFAULT_TIMEOUT
),
"decode_responses": kwargs.get("decode_responses", True),
"max_connections": kwargs.get("max_connections", 10),
"max_connections": kwargs.get("max_connections", 50),
"health_check_interval": kwargs.get("health_check_interval", 30),
"retry_on_timeout": kwargs.get("retry_on_timeout", True),
"socket_keepalive": kwargs.get("socket_keepalive", True),
}
# Add any additional parameters