fix timezone logic bug for run once tasks
This commit is contained in:
parent
8f6056ae66
commit
9f95c57a09
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue