telegram_bots/feeds/management/commands/periodic_feeds.py

21 lines
503 B
Python

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()
sleep(10*60)
except KeyboardInterrupt:
return
except Exception as e:
sentry_sdk.capture_exception(e)
traceback.print_exc()