diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2013-10-31 11:45:19 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2013-10-31 11:45:19 -0700 |
commit | 976e72be529fdf741b75a71746f34c6530fc8ae9 (patch) | |
tree | dc5c9048e654d577457b2a758bd375be083c981a /redis/sentinel.py | |
parent | f95410bf667653983b9effe49303b97e8719925a (diff) | |
parent | 94510e44522d42896e22bb528fc73468b1fde09a (diff) | |
download | redis-py-976e72be529fdf741b75a71746f34c6530fc8ae9.tar.gz |
Merge pull request #396 from reclosedev/sentinel-pool
Override _checkpid() in SentinelConnectionPool (#395)
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): """ |