diff options
author | Roman Haritonov <rharitonov@asdco.ru> | 2013-10-30 17:47:18 +0400 |
---|---|---|
committer | Roman Haritonov <reclosedev@gmail.com> | 2013-10-30 21:44:01 +0400 |
commit | 94510e44522d42896e22bb528fc73468b1fde09a (patch) | |
tree | dc5c9048e654d577457b2a758bd375be083c981a /redis/sentinel.py | |
parent | f95410bf667653983b9effe49303b97e8719925a (diff) | |
download | redis-py-94510e44522d42896e22bb528fc73468b1fde09a.tar.gz |
Override _checkpid() in SentinelConnectionPool
Diffstat (limited to 'redis/sentinel.py')
-rw-r--r-- | redis/sentinel.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/redis/sentinel.py b/redis/sentinel.py index bdb955f..8ba9920 100644 --- a/redis/sentinel.py +++ b/redis/sentinel.py @@ -1,3 +1,4 @@ +import os import random from redis.client import StrictRedis @@ -90,6 +91,14 @@ class SentinelConnectionPool(ConnectionPool): pass raise SlaveNotFoundError('No slave found for %r' % (self.service_name)) + def _checkpid(self): + if self.pid != os.getpid(): + self.disconnect() + self.__init__(self.service_name, self.sentinel_manager, + connection_class=self.connection_class, + max_connections=self.max_connections, + **self.connection_kwargs) + class Sentinel(object): """ |