diff options
| author | Andy McCurdy <andy@andymccurdy.com> | 2020-06-01 11:36:03 -0700 |
|---|---|---|
| committer | Andy McCurdy <andy@andymccurdy.com> | 2020-06-01 11:36:03 -0700 |
| commit | 6518c0812667b567fca365481366f07a38e0d755 (patch) | |
| tree | c463f41fb309f63c6a4e1fc0acad493f91f4ff8a | |
| parent | d22b92bd530057f2514b84733efd580717d999d8 (diff) | |
| download | redis-py-6518c0812667b567fca365481366f07a38e0d755.tar.gz | |
clearer naming
| -rwxr-xr-x | redis/connection.py | 6 | ||||
| -rw-r--r-- | redis/sentinel.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/redis/connection.py b/redis/connection.py index 4f26e7a..e412f05 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -1237,7 +1237,7 @@ class ConnectionPool(object): # that the pool doesn't actually own pass - if self.pool_owns_connection(connection): + if self.owns_connection(connection): self._available_connections.append(connection) else: # pool doesn't own this connection. do not add it back @@ -1247,7 +1247,7 @@ class ConnectionPool(object): connection.disconnect() return - def pool_owns_connection(self, connection): + def owns_connection(self, connection): return connection.pid == self.pid def disconnect(self): @@ -1390,7 +1390,7 @@ class BlockingConnectionPool(ConnectionPool): "Releases the connection back to the pool." # Make sure we haven't changed process. self._checkpid() - if not self.pool_owns_connection(connection): + if not self.owns_connection(connection): # pool doesn't own this connection. do not add it back # to the pool. instead add a None value which is a placeholder # that will cause the pool to recreate the connection if diff --git a/redis/sentinel.py b/redis/sentinel.py index 28cd17e..bbc4cf5 100644 --- a/redis/sentinel.py +++ b/redis/sentinel.py @@ -95,12 +95,12 @@ class SentinelConnectionPool(ConnectionPool): self.master_address = None self.slave_rr_counter = None - def pool_owns_connection(self, connection): + def owns_connection(self, connection): check = not self.is_master or \ (self.is_master and self.master_address == (connection.host, connection.port)) parent = super(SentinelConnectionPool, self) - return check and parent.pool_owns_connection(connection) + return check and parent.owns_connection(connection) def get_master_address(self): master_address = self.sentinel_manager.discover_master( |
