From 6e88e52d780b83b7ea028acc957dd26b7dd86936 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 17 Jan 2021 19:22:01 +0100 Subject: [PATCH] outposts: add message to outpost_service_connection_monitor task --- authentik/outposts/tasks.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/authentik/outposts/tasks.py b/authentik/outposts/tasks.py index da05a41cf..8ce64c77a 100644 --- a/authentik/outposts/tasks.py +++ b/authentik/outposts/tasks.py @@ -49,9 +49,15 @@ def outpost_service_connection_state(connection_pk: Any): @CELERY_APP.task(bind=True, base=MonitoredTask) def outpost_service_connection_monitor(self: MonitoredTask): """Regularly check the state of Outpost Service Connections""" - for connection in OutpostServiceConnection.objects.all(): + connections = OutpostServiceConnection.objects.all() + for connection in connections.iterator(): outpost_service_connection_state.delay(connection.pk) - self.set_status(TaskResult(TaskResultStatus.SUCCESSFUL)) + self.set_status( + TaskResult( + TaskResultStatus.SUCCESSFUL, + [f"Successfully updated {len(connections)} connections."], + ) + ) @CELERY_APP.task(bind=True, base=MonitoredTask)