From 1348eb04dad39eaef67f80ac13206060e66ae08b Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Sat, 10 Jul 2021 00:18:33 +0200 Subject: [PATCH] Added sched module for the loop --- pastafaristats/send_info_cron.py | 2 +- pastafaristats/send_info_daemon.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pastafaristats/send_info_cron.py b/pastafaristats/send_info_cron.py index 53d2594..e06cae4 100644 --- a/pastafaristats/send_info_cron.py +++ b/pastafaristats/send_info_cron.py @@ -3,5 +3,5 @@ from pastafaristats import send_info_daemon url, group=send_info_daemon.load_config() if __name__=='__main__': - send_info_daemon.run(url) + send_info_daemon.run(url, group) diff --git a/pastafaristats/send_info_daemon.py b/pastafaristats/send_info_daemon.py index c392e62..35bd00e 100644 --- a/pastafaristats/send_info_daemon.py +++ b/pastafaristats/send_info_daemon.py @@ -141,9 +141,19 @@ def run_start(sc): url, group=load_config() - run(url, group) + sec=str(datetime.datetime.utcnow()) - sc.enter(60, 1, run_start, (sc,)) + print('Send monitoring in %s...' % sec) + + num_seconds=int(sec[17:19]) + + total_seconds=60 + + final_seconds=total_seconds-num_seconds + + sc.enter(final_seconds, 1, run_start, (sc,)) + + run(url, group) """ while True: