cron: add an every5min entry (#82961)
gitea/passerelle/pipeline/head This commit looks good Details

This commit is contained in:
Nicolas Roche 2023-10-30 16:27:37 +01:00 committed by Nicolas Roche
parent 8892a97435
commit bda1eba253
4 changed files with 10 additions and 3 deletions

1
debian/uwsgi.ini vendored
View File

@ -18,6 +18,7 @@ spooler-python-import = passerelle.utils.spooler
spooler-max-tasks = 20
# every five minutes
unique-cron = -5 -1 -1 -1 -1 /usr/bin/passerelle-manage tenant_command cron --all-tenants every5min
unique-cron = -5 -1 -1 -1 -1 /usr/bin/passerelle-manage tenant_command cron --all-tenants availability
unique-cron = -5 -1 -1 -1 -1 /usr/bin/passerelle-manage tenant_command cron --all-tenants jobs
# hourly

View File

@ -28,7 +28,10 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'frequency', metavar='FREQUENCY', type=str, help='hourly/daily/weekly/monthly/availability/jobs'
'frequency',
metavar='FREQUENCY',
type=str,
help='every5min/hourly/daily/weekly/monthly/availability/jobs',
)
parser.add_argument(
'--connector',
@ -46,7 +49,7 @@ class Command(BaseCommand):
)
def handle(self, frequency, **options):
if frequency not in ('hourly', 'daily', 'weekly', 'monthly', 'availability', 'jobs'):
if frequency not in ('every5min', 'hourly', 'daily', 'weekly', 'monthly', 'availability', 'jobs'):
raise CommandError('unknown frequency')
errors = []
for app in get_all_apps():

View File

@ -588,6 +588,9 @@ class BaseResource(models.Model):
else:
ResourceStatus.objects.filter(pk=current_status.pk).update(message=message)
def every5min(self):
pass
def hourly(self):
pass

View File

@ -8,7 +8,7 @@ from passerelle.apps.base_adresse.models import BaseAdresse
def test_cron_frequencies(db):
for frequency in ('hourly', 'daily', 'weekly', 'monthly'):
for frequency in ('every5min', 'hourly', 'daily', 'weekly', 'monthly'):
call_command('cron', frequency)
with pytest.raises(CommandError):
call_command('cron', 'randomly')