diff --git a/ConsumerLocator.py b/ConsumerLocator.py index 410c644..e70816d 100644 --- a/ConsumerLocator.py +++ b/ConsumerLocator.py @@ -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