Merge "Fix matchmaker_redis ack_alive fails with KeyError"

This commit is contained in:
Jenkins 2015-03-06 17:00:38 +00:00 committed by Gerrit Code Review
commit f41b4478ed
2 changed files with 7 additions and 1 deletions

View File

@ -105,7 +105,7 @@ class MatchMakerRedis(mm_common.HeartbeatMatchMakerBase):
# If we could not update the expiration, the key
# might have been pruned. Re-register, creating a new
# key in Redis.
self.register(self.host_topic[host], host)
self.register(key, host)
def is_alive(self, topic, host):
if self.redis.ttl(host) == -1:

View File

@ -81,3 +81,9 @@ class RedisMatchMakerTest(test_utils.BaseTestCase):
self.assertEqual(
sorted(self.matcher.redis.smembers('conductor')),
['conductor.node1', 'conductor.node2', 'conductor.node3'])
def test_ack_alive(self):
self.matcher.ack_alive('ack_alive', 'controller1')
self.assertEqual(
sorted(self.matcher.redis.smembers('ack_alive')),
['ack_alive.controller1'])