Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def update_next_trigger_at(self):
tz = pytz.timezone(self.timezone)
dt = tz.normalize(django_timezone.now())
self.next_trigger_at = croniter(self.schedule, dt).get_next(datetime)
def update_next_trigger_at(self):
base_time = django_timezone.now().replace(tzinfo=pytz.timezone(self.timezone))
self.next_trigger_at = croniter(self.schedule, base_time).get_next(datetime)
def _update_next_trigger_at(self):
"""
Defines next backup creation time
"""
base_time = django_timezone.now().replace(tzinfo=pytz.timezone(self.timezone))
self.next_trigger_at = croniter(self.schedule, base_time).get_next(datetime)
def initialize(self):
"""Initialize croniter and related times"""
if self.croniter is None:
self.time = time.time()
self.datetime = datetime.now(get_localzone())
self.loop_time = self.loop.time()
self.croniter = croniter(self.spec, start_time=self.datetime)
def get_next_utc_execution(self):
tz = pytz.timezone(self.timezone)
if not self.next_execution:
base = tz.normalize(datetime.now(tz) - timedelta(minutes=1))
elif self.skip_delayed_jobs_next_time:
base = tz.normalize(datetime.now(tz))
else:
base = tz.normalize(self.next_execution.replace(tzinfo=pytz.utc))
cron = croniter(self.schedule, base)
return cron.get_next(datetime).astimezone(pytz.utc)