Fixed communicator method names in ConsumerLocator
This commit is contained in:
parent
98b1bb8e56
commit
25d582cccc
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import datetime
|
||||
import communicator
|
||||
|
||||
"""
|
||||
Main Flask RESTful API
|
||||
@ -29,7 +30,7 @@ class ConsumerLocator:
|
||||
""""
|
||||
Learns the list of consumers.
|
||||
"""
|
||||
recievedConsumerList = communicator.getConsumerList()
|
||||
recievedConsumerList = communicator.discoveravailableconsumers()
|
||||
for consumer in recievedConsumerList:
|
||||
self.consumerList.append({"Host": consumer, "State": True, "LastOk": datetime.datetime.now()})
|
||||
self.updateConsumerList()
|
||||
@ -40,7 +41,7 @@ class ConsumerLocator:
|
||||
"""
|
||||
removeList = []
|
||||
for consumer in self.consumerList:
|
||||
if not communicator.ping(consumer["Host"]):
|
||||
if not communicator.isconsumeravailable(consumer["Host"]):
|
||||
consumer["State"] = False
|
||||
if datetime.datetime.now() - consumer["LastOk"] > datetime.timedelta(hours=1):
|
||||
removeList.append(consumer)
|
||||
@ -84,7 +85,7 @@ class ConsumerLocator:
|
||||
Check the consumers health.
|
||||
:return: True if OK, False if fail
|
||||
"""
|
||||
if communicator.ping(self.currentConsumer["Host"]):
|
||||
if communicator.isconsumeravailable(self.currentConsumer["Host"]):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
Reference in New Issue
Block a user