From 2f5bfe927aba9a8bb40676115609aa39e55e3db0 Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Indicio work address)" Date: Tue, 24 May 2022 12:24:11 -0600 Subject: [PATCH] feat: Add config option for Redis pool Signed-off-by: Colton Wolkins (Indicio work address) --- acapy_cache_redis/v0_1/redis_base_cache.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/acapy_cache_redis/v0_1/redis_base_cache.py b/acapy_cache_redis/v0_1/redis_base_cache.py index 9b3d05c..f891290 100644 --- a/acapy_cache_redis/v0_1/redis_base_cache.py +++ b/acapy_cache_redis/v0_1/redis_base_cache.py @@ -44,6 +44,13 @@ def __init__(self, root_profile: Profile) -> None: except KeyError as error: pass + # Get the connection string + try: + max_connections = int(config["max_connections"]) + except: + max_connections = 50 + LOGGER.debug(f"Max Redis Cache Pool connections set to: {max_connections}") + # Get the SSL CA Cert information (special redis SSL implementations only) try: lssl = config["ssl"] @@ -58,7 +65,7 @@ def __init__(self, root_profile: Profile) -> None: # Setup the aioredis instance self.pool = aioredis.ConnectionPool.from_url( self.connection, - max_connections=10, + max_connections=max_connections, username=username, password=password, # ssl_ca_certs=ca_cert,