Coverage for seedboxsync/core/taskmanager/task/task_periodic_sync_blackhole.py: 0%
12 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-26 17:46 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-26 17:46 +0000
1#
2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr>
3#
4# For the full copyright and license information, please view the LICENSE
5# file that was distributed with this source code.
6#
7"""Define a huey tasks for blackhole synchronization."""
9import os
10from huey import crontab
11from seedboxsync.core import current_app as app
12from seedboxsync.core.sync.services import (
13 BLACKHOLE_LOCK_NAME as LOCK_NAME,
14 BLACKHOLE_PRIORITY as PRIORITY,
15 blackhole as blackhole_service,
16)
18task_manager = app.task_manager
19ctx = app.app_context()
20minute = os.getenv("SYNC_BLACKHOLE_MINUTE", "*")
23@task_manager.periodic_task(crontab(minute=minute), priority=PRIORITY) # type: ignore[untyped-decorator]
24@task_manager.lock_task(LOCK_NAME) # type: ignore[untyped-decorator]
25def periodic_sync_blackhole() -> None:
26 """Define a huey periodic task."""
27 with ctx:
28 blackhole_service(False, True)