def run(self):
if len(self.__update_rates) == 0:
return
# wait up to 120 seconds, to get some distortion
self.__stop_event.wait(randint(0, 120))
while not self.__stop_event.is_set():
start = time.time()
for update in self.__update_rates:
rate = update[0]
now = time.time()
time_to_wait = round(start - now + rate / 1000, 0)
interrupt = self.__stop_event.wait(time_to_wait)
if interrupt:
return
try:
self.start_calculation(update[1])
except URLError as e:
logging.getLogger(__name__).error("Could not connect to InfluxDB: " + str(e))
except:
logging.getLogger(__name__).error("Job execution failed", exc_info=True)
评论列表
文章目录