misc: align jump checks with the "hourly" cron jobs (#38159)

This commit is contained in:
Frédéric Péters 2019-12-03 13:36:27 +01:00
parent d165872b4c
commit 6a549fb053
4 changed files with 11 additions and 8 deletions

View File

@ -1659,8 +1659,8 @@ if get_publisher_class():
# once a month, look for drafts to remove
get_publisher_class().register_cronjob(CronJob(clean_drafts,
name='clean_drafts',
days=[2], hours=[0], minutes=[0]))
days=[2], hours=[0], minutes=[0], hourly=True))
# once a day, look for unused files
get_publisher_class().register_cronjob(CronJob(clean_unused_files,
name='clean_unused_files',
hours=[2], minutes=[0]))
hours=[2], minutes=[0], hourly=True))

View File

@ -1692,6 +1692,6 @@ def handle_expired_tokens(publisher):
if get_publisher_class():
# at 6:00 in the morning, every day
get_publisher_class().register_cronjob(
CronJob(handle_unused_accounts, minutes=[0], hours=[6]))
CronJob(handle_unused_accounts, minutes=[0], hours=[6], hourly=True))
get_publisher_class().register_cronjob(
CronJob(handle_expired_tokens, minutes=[10], hours=[6]))
CronJob(handle_expired_tokens, minutes=[10], hours=[6], hourly=True))

View File

@ -156,5 +156,4 @@ def send_aggregation_emails(publisher):
if get_publisher_class():
# at 6:00 in the morning, every day but the week end
get_publisher_class().register_cronjob(
CronJob(send_aggregation_emails, minutes=[0], hours=[6], weekdays=range(5)))
CronJob(send_aggregation_emails, hours=[6], minutes=[0], hourly=True, weekdays=range(5)))

View File

@ -19,6 +19,7 @@ import json
import os
import sys
from django.conf import settings
from django.utils import six
from quixote import get_publisher, get_request, redirect
@ -302,8 +303,11 @@ def _apply_timeouts(publisher):
if get_publisher_class():
# every JUMP_TIMEOUT_INTERVAL minutes check for expired status jump
# timeouts.
# timeouts; align checks with the "hourly" check defined in
# wcs/qommon/cron.py
minutes = [(x + ord(settings.SECRET_KEY[-1])) % 60
for x in range(0, 60, JUMP_TIMEOUT_INTERVAL)]
get_publisher_class().register_cronjob(
CronJob(_apply_timeouts,
name='evaluate_jumps',
hours=range(24), minutes=range(0, 60, JUMP_TIMEOUT_INTERVAL)))
hours=range(24), minutes=minutes))