From 68842a187c629e376a3ef0baa535efe5f20bfecb Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:14:33 +0800 Subject: [PATCH] Opt: Align assignment to server update so save time on cloud --- tasks/assignment/assignment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/assignment/assignment.py b/tasks/assignment/assignment.py index 8a76ded7d..ef537dfaf 100644 --- a/tasks/assignment/assignment.py +++ b/tasks/assignment/assignment.py @@ -74,6 +74,11 @@ class Assignment(AssignmentClaim, SynthesizeUI): delay = min(self.dispatched.values()) logger.info(f'Delay assignment check to {str(delay)}') self.config.task_delay(target=delay) + # Align server update + update = get_server_next_update(self.config.Scheduler_ServerUpdate) + if update - delay < timedelta(hours=4): + logger.info('Approaching next day, delay to server update instead') + self.config.task_delay(target=update) else: # ValueError: min() arg is an empty sequence logger.error('Empty dispatched list, delay 2 hours instead')