Learn available consumers after switching current consumer

This commit is contained in:
Scharnitzky Donát 2020-03-29 18:00:00 +02:00
parent 6df7089900
commit 36272830d5

View File

@ -33,9 +33,10 @@ class ConsumerLocator:
""""
Learns the list of consumers.
"""
#TODO improve learning
recievedConsumerList = self.communicator.discoveravailableconsumers()
for consumer in recievedConsumerList:
recievedconsumerlist = self.communicator.discoveravailableconsumers()
if recievedconsumerlist is None:
return
for consumer in recievedconsumerlist:
self.consumerList.append({"Host": consumer, "State": True, "LastOk": datetime.datetime.now()})
self.updateConsumerList()
@ -71,6 +72,7 @@ class ConsumerLocator:
break
self.currentConsumer = newCurrentConsumer
self.learnconsumerlist()
if self.currentConsumer is not None:
return self.currentConsumer["Host"]