Chunk, then sleep until next schedule
This commit is contained in:
@@ -732,10 +732,10 @@ if __name__ == "__main__":
|
|||||||
print(f"Container started, task will run daily at {RUN_AT}", flush=True)
|
print(f"Container started, task will run daily at {RUN_AT}", flush=True)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
main()
|
||||||
wait_seconds = calc_wait_time(RUN_AT)
|
wait_seconds = calc_wait_time(RUN_AT)
|
||||||
print(f"Next run in {wait_seconds / 3600:.2f} hours.", flush=True)
|
print(f"Next run in {wait_seconds / 3600:.2f} hours.", flush=True)
|
||||||
time.sleep(wait_seconds)
|
time.sleep(wait_seconds)
|
||||||
main()
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Container stopped manually", flush=True)
|
print("Container stopped manually", flush=True)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user