Connection pool garbage collection of idle connections
Version: What redis-py and what redis version is the issue happening on? redis-py 5.2.0 with redis 7.2.4
Platform: What platform / version? Python 3.10.12 on Ubuntu 22.04
Description:
Hey everyone,
I have an application that uses a Redis connection created from a connection from a connection pool. The pool works as expected, but there is a point during the lifetime of my application where a connection is not used for some time (i.e., it stays in the pool as an available connection). There is some configuration that I am not finding to discard unused connections after some time? Or do I have to manually close those connections?
Best regards, Jorge
Hi, I haven't seen such a configuration in the code. The connections are stored in the connection_pool and reused - when a connection is acquired from the list with available connections - a health check is performed - the flow includes a validation that ensures the connection is healthy - in case it isn't - it is reconnected, but there is not logic to discard unused connections after predefined period.
Since the question has been answered, I’ll close the issue for now. Feel free to reopen it if you need further assistance.