Skip to content

redis's connection pool makes me wonder #2832

@forthcoming

Description

@forthcoming

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions