diff --git a/api/tacticalrmm/autotasks/models.py b/api/tacticalrmm/autotasks/models.py index e27a19a5..4682259e 100644 --- a/api/tacticalrmm/autotasks/models.py +++ b/api/tacticalrmm/autotasks/models.py @@ -3,6 +3,7 @@ import random import string from contextlib import suppress from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from zoneinfo import ZoneInfo import pytz from django.core.cache import cache @@ -270,8 +271,8 @@ class AutomatedTask(BaseAuditModel): and self.task_type == TaskType.RUN_ONCE and self.run_asap_after_missed and agent - and self.run_time_date - < djangotime.now().astimezone(pytz.timezone(agent.timezone)) + and self.run_time_date.replace(tzinfo=ZoneInfo(agent.timezone)) + < djangotime.now().astimezone(ZoneInfo(agent.timezone)) ): self.run_time_date = ( djangotime.now() + djangotime.timedelta(minutes=5)