summaryrefslogtreecommitdiff
path: root/oslo_messaging/_drivers/matchmaker_redis.py
diff options
context:
space:
mode:
Diffstat (limited to 'oslo_messaging/_drivers/matchmaker_redis.py')
-rw-r--r--oslo_messaging/_drivers/matchmaker_redis.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/oslo_messaging/_drivers/matchmaker_redis.py b/oslo_messaging/_drivers/matchmaker_redis.py
index 4f6e6f0..290b603 100644
--- a/oslo_messaging/_drivers/matchmaker_redis.py
+++ b/oslo_messaging/_drivers/matchmaker_redis.py
@@ -108,7 +108,12 @@ class MatchMakerRedis(mm_common.HeartbeatMatchMakerBase):
self.register(key, host)
def is_alive(self, topic, host):
- if self.redis.ttl(host) == -1:
+ # After redis 2.8, if the specialized key doesn't exist,
+ # TTL fuction would return -2. If key exists,
+ # but doesn't have expiration associated,
+ # TTL func would return -1. For more information,
+ # please visit http://redis.io/commands/ttl
+ if self.redis.ttl(host) == -2:
self.expire(topic, host)
return False
return True