diff --git a/authentik/stages/authenticator_duo/api.py b/authentik/stages/authenticator_duo/api.py index cccdd1dc1d..863eea4903 100644 --- a/authentik/stages/authenticator_duo/api.py +++ b/authentik/stages/authenticator_duo/api.py @@ -159,7 +159,7 @@ class AuthenticatorDuoStageViewSet(UsedByMixin, ModelViewSet): }, status=400, ) - result = duo_import_devices.delay(str(stage.pk)).get() + result = duo_import_devices.send(str(stage.pk)).get_result() return Response(data=result, status=200 if result["error"] == "" else 400) diff --git a/authentik/stages/authenticator_duo/tasks.py b/authentik/stages/authenticator_duo/tasks.py index b97c1e39ee..c5824a9926 100644 --- a/authentik/stages/authenticator_duo/tasks.py +++ b/authentik/stages/authenticator_duo/tasks.py @@ -1,15 +1,15 @@ """duo tasks""" +from dramatiq.actor import actor from structlog.stdlib import get_logger from authentik.core.models import User -from authentik.root.celery import CELERY_APP from authentik.stages.authenticator_duo.models import AuthenticatorDuoStage, DuoDevice LOGGER = get_logger() -@CELERY_APP.task() +@actor(store_results=True) def duo_import_devices(stage_pk: str): """Import duo devices""" created = 0