def _create_client(self, max_connections: int = 50) -> redis.Redis:
        """Create a Redis client with specified connection pool size."""
        # Create connection pool with proper configuration
        pool = redis.ConnectionPool(
            host=settings.REDIS_HOST,
            port=settings.REDIS_PORT,
            db=settings.REDIS_DB,
            password=settings.REDIS_PASSWORD if settings.REDIS_PASSWORD else None,
            decode_responses=True,
            max_connections=max_connections,
            retry_on_timeout=True,
            socket_keepalive=True,
            socket_keepalive_options=self._get_socket_keepalive_options(),
            socket_connect_timeout=5,  # Add connection timeout
            socket_timeout=5,  # Add socket timeout
            retry_on_error=[ConnectionError, TimeoutError],  # Retry on these errors
        )

        return redis.Redis(connection_pool=pool)
Create a Redis client with specified connection pool size.
backend/airweave/core/redis_client.py