From e2e214449d3829f1c27b40a7908962732c4ae847 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Tue, 21 Mar 2023 23:30:07 +0100 Subject: [PATCH] fix wikipedia fetch --- acros/management/commands/refetch_wikipedia.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/acros/management/commands/refetch_wikipedia.py b/acros/management/commands/refetch_wikipedia.py index 42434dc..35abffd 100644 --- a/acros/management/commands/refetch_wikipedia.py +++ b/acros/management/commands/refetch_wikipedia.py @@ -1,6 +1,8 @@ import time +from datetime import timedelta from django.core.management.base import BaseCommand +from django.utils import timezone from acros.models import WikipediaLink @@ -11,10 +13,12 @@ class Command(BaseCommand): def handle(self, *args, **options): links = WikipediaLink.objects.all() for link in links: - print(link) self.stdout.write(link.title) + if link.timestamp >= (timezone.now() - timedelta(days=180)): + print("skipped") + continue link.fetched = False # update_change_reason(link, "refetch_wikipedia command") link.clean() link.save() - time.sleep(1) + time.sleep(3)