redis's connection pool makes me wonder · Issue #2832 · redis/redis-py (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
https://github.com/redis/redis-py/blob/master/redis/connection.py#L1515
def release(self, connection):
self._checkpid()
with self._lock:
try:
self._in_use_connections.remove(connection)
except KeyError:
pass
if self.owns_connection(connection):
self._available_connections.append(connection)
else:
# pool doesn't own this connection. do not add it back
# to the pool and decrement the count so that another
# connection can take its place if needed
self._created_connections -= 1
connection.disconnect()
return
Since you don't own this connection, it means that the program has been fork, and _created_connections has been initialized to 0, why subtract 1 again?Can someone explain it to me?,thanks