Handle the case with no links in check command

This commit is contained in:
Quantum 2022-01-31 02:07:31 -05:00
parent ff74e1c502
commit 3dfc0a3682

View file

@ -36,7 +36,7 @@ class Command(BaseCommand):
self.check_links() self.check_links()
next_check = Link.objects.aggregate(min=Min('next_check'))['min'] next_check = Link.objects.aggregate(min=Min('next_check'))['min']
wait = (next_check - timezone.now()).total_seconds() wait = (next_check - timezone.now() if next_check else settings.QLINKS_CHECK_MIN).total_seconds()
if wait > 0: if wait > 0:
if self.verbosity > 2: if self.verbosity > 2:
self.stdout.write(f'Sleeping for: {wait:.0f} seconds') self.stdout.write(f'Sleeping for: {wait:.0f} seconds')