Coverage for seedboxsync/core/taskmanager/task/task_sync_blackhole.py: 100%
11 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +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 seedboxsync.core import current_app
11from seedboxsync.core.sync.services import (
12 BLACKHOLE_LOCK_NAME as LOCK_NAME,
13 BLACKHOLE_PRIORITY as PRIORITY,
14 blackhole as blackhole_service,
15)
17task_manager = current_app.task_manager
18ctx = current_app.app_context()
19minute = os.getenv("SYNC_BLACKHOLE_MINUTE", "*")
22@task_manager.task(priority=PRIORITY) # type: ignore[untyped-decorator]
23@task_manager.lock_task(LOCK_NAME) # type: ignore[untyped-decorator]
24def sync_blackhole() -> None:
25 """Define a huey task."""
26 with ctx:
27 blackhole_service(False, True)