Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
last_update = self.status.get_datetime('last update', 'hourly')
if not last_update or last_update < threshold:
sections.append('hourly')
# daily
threshold = timezone.local_replace(
threshold, use_dst=self.use_dst, hour=self.day_end_hour)
last_update = self.status.get_datetime('last update', 'daily')
if not last_update or last_update < threshold:
sections.append('daily')
# 12 hourly == daily
last_update = self.status.get_datetime('last update', '12 hourly')
if not last_update or last_update < threshold:
sections.append('12 hourly')
return sections
# 12 hourly == daily +- 12 hours
threshold = timezone.local_replace(
now, use_dst=self.use_dst,
hour=((self.day_end_hour + 12) % 24), minute=0, second=0)
if last_update < threshold:
sections.append('12 hourly')
return sections
def _periodic_due(self, now):
# get start of current hour, allowing for odd time zones
threshold = timezone.local_replace(now, minute=0, second=0)
# make list of due sections
sections = []
# hourly
last_update = self.status.get_datetime('last update', 'hourly')
if not last_update or last_update < threshold:
sections.append('hourly')
# daily
threshold = timezone.local_replace(
threshold, use_dst=self.use_dst, hour=self.day_end_hour)
last_update = self.status.get_datetime('last update', 'daily')
if not last_update or last_update < threshold:
sections.append('daily')
# 12 hourly == daily
last_update = self.status.get_datetime('last update', '12 hourly')
if not last_update or last_update < threshold:
sections.append('12 hourly')
return sections
# 12 hourly == daily +- 12 hours
threshold = timezone.local_replace(
now, use_dst=self.use_dst,
hour=((self.day_end_hour + 12) % 24), minute=0, second=0)
if last_update < threshold:
sections.append('12 hourly')
return sections
def _periodic_due(self, now):
# get start of current hour, allowing for odd time zones
threshold = timezone.local_replace(now, minute=0, second=0)
# make list of due sections
sections = []
# hourly
last_update = self.status.get_datetime('last update', 'hourly')
if not last_update or last_update < threshold:
sections.append('hourly')
# daily
threshold = timezone.local_replace(
threshold, use_dst=self.use_dst, hour=self.day_end_hour)
last_update = self.status.get_datetime('last update', 'daily')
if not last_update or last_update < threshold:
sections.append('daily')
# 12 hourly == daily
last_update = self.status.get_datetime('last update', '12 hourly')
if not last_update or last_update < threshold:
sections.append('12 hourly')