Coverage for seedboxsync/core/taskmanager/task/task_periodic_sync_seedbox.py: 0%

12 statements  

« 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 seedbox synchronization.""" 

8 

9import os 

10from huey import crontab 

11from seedboxsync.core import current_app as app 

12from seedboxsync.core.sync.services import ( 

13 SEEDBOX_LOCK_NAME as LOCK_NAME, 

14 SEEDBOX_PRIORITY as PRIORITY, 

15 seedbox as seedbox_service, 

16) 

17 

18task_manager = app.task_manager 

19ctx = app.app_context() 

20minute = os.getenv("SYNC_SEEDBOX_MINUTE", "*/15") 

21 

22 

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_seedbox() -> None: 

26 """Define a huey periodic task.""" 

27 with ctx: 

28 seedbox_service(False, True, False)