*: add @prefill_task() decorator to "pre-fill" tasks in cache, so they can be executed even before their schedule would do so
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -15,7 +15,12 @@ from kubernetes.config.incluster_config import SERVICE_HOST_ENV_NAME | ||||
| from structlog.stdlib import get_logger | ||||
|  | ||||
| from authentik.core.models import AuthenticatedSession, ExpiringModel | ||||
| from authentik.events.monitored_tasks import MonitoredTask, TaskResult, TaskResultStatus | ||||
| from authentik.events.monitored_tasks import ( | ||||
|     MonitoredTask, | ||||
|     TaskResult, | ||||
|     TaskResultStatus, | ||||
|     prefill_task, | ||||
| ) | ||||
| from authentik.lib.config import CONFIG | ||||
| from authentik.root.celery import CELERY_APP | ||||
|  | ||||
| @ -23,6 +28,7 @@ LOGGER = get_logger() | ||||
|  | ||||
|  | ||||
| @CELERY_APP.task(bind=True, base=MonitoredTask) | ||||
| @prefill_task() | ||||
| def clean_expired_models(self: MonitoredTask): | ||||
|     """Remove expired objects""" | ||||
|     messages = [] | ||||
| @ -50,6 +56,7 @@ def clean_expired_models(self: MonitoredTask): | ||||
|  | ||||
|  | ||||
| @CELERY_APP.task(bind=True, base=MonitoredTask) | ||||
| @prefill_task() | ||||
| def backup_database(self: MonitoredTask):  # pragma: no cover | ||||
|     """Database backup""" | ||||
|     self.result_timeout_hours = 25 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer