Use robust plugin calling in runperiodic

This commit is contained in:
Raphael Michel
2019-07-25 09:20:34 +02:00
parent 3091139aab
commit 6df1960f79
2 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
@@ -8,5 +9,12 @@ class Command(BaseCommand):
help = "Run periodic tasks"
def handle(self, *args, **options):
periodic_task.send(self)
for recv, resp in periodic_task.send_robust(self):
if isinstance(resp, Exception):
if settings.SENTRY_ENABLED:
from sentry_sdk import capture_exception
capture_exception(resp)
else:
raise resp
call_command('clearsessions')