From 7d623f353dfd8ef03d956335ea963f1c1e42a603 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 25 Nov 2019 22:42:20 +0300 Subject: [PATCH] forgot management task --- feeds/management/commands/periodic_feeds.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 feeds/management/commands/periodic_feeds.py diff --git a/feeds/management/commands/periodic_feeds.py b/feeds/management/commands/periodic_feeds.py new file mode 100644 index 0000000..30a7b2a --- /dev/null +++ b/feeds/management/commands/periodic_feeds.py @@ -0,0 +1,20 @@ +import traceback +from time import sleep + +import sentry_sdk +from django.core.management import BaseCommand + +from feeds.tasks import check_feeds + + +class Command(BaseCommand): + def handle(self, *args, **options): + while True: + try: + check_feeds.apply_async() + except KeyboardInterrupt: + return + except Exception as e: + sentry_sdk.capture_exception(e) + traceback.print_exc() + sleep(10*60)