mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-18 11:06:36 +00:00
Rename exponential_backoff
to dynamic_retry
This commit is contained in:
parent
a4040928be
commit
2c203572a2
@ -61,7 +61,7 @@ def sqlite_tasks(key, /, prefix=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def exponential_backoff(task_func=None, /, *args, **kwargs):
|
def dynamic_retry(task_func=None, /, *args, **kwargs):
|
||||||
if task_func is None:
|
if task_func is None:
|
||||||
from django_huey import task as huey_task
|
from django_huey import task as huey_task
|
||||||
task_func = huey_task
|
task_func = huey_task
|
||||||
|
@ -29,7 +29,7 @@ from background_task.exceptions import InvalidTaskError
|
|||||||
from background_task.models import Task, CompletedTask
|
from background_task.models import Task, CompletedTask
|
||||||
from django_huey import db_periodic_task, db_task, task as huey_task # noqa
|
from django_huey import db_periodic_task, db_task, task as huey_task # noqa
|
||||||
from huey import CancelExecution
|
from huey import CancelExecution
|
||||||
from common.huey import exponential_backoff
|
from common.huey import dynamic_retry
|
||||||
from common.logger import log
|
from common.logger import log
|
||||||
from common.errors import ( BgTaskWorkerError, DownloadFailedException,
|
from common.errors import ( BgTaskWorkerError, DownloadFailedException,
|
||||||
NoFormatException, NoMediaException,
|
NoFormatException, NoMediaException,
|
||||||
@ -555,7 +555,7 @@ def check_source_directory_exists(source_id):
|
|||||||
source.make_directory()
|
source.make_directory()
|
||||||
|
|
||||||
|
|
||||||
@exponential_backoff(db_task, delay=10, priority=90, retries=15, queue=Val(TaskQueue.NET))
|
@dynamic_retry(db_task, delay=10, priority=90, retries=15, queue=Val(TaskQueue.NET))
|
||||||
def download_source_images(source_id):
|
def download_source_images(source_id):
|
||||||
'''
|
'''
|
||||||
Downloads an image and save it as a local thumbnail attached to a
|
Downloads an image and save it as a local thumbnail attached to a
|
||||||
@ -895,7 +895,7 @@ def save_all_media_for_source(source_id):
|
|||||||
update_task_status(task, None)
|
update_task_status(task, None)
|
||||||
|
|
||||||
|
|
||||||
@exponential_backoff(db_task, priority=50, retries=15, queue=Val(TaskQueue.LIMIT))
|
@dynamic_retry(db_task, backoff_func=lambda n: (n*3600)+600, priority=50, retries=15, queue=Val(TaskQueue.LIMIT))
|
||||||
def refresh_formats(media_id):
|
def refresh_formats(media_id):
|
||||||
try:
|
try:
|
||||||
media = Media.objects.get(pk=media_id)
|
media = Media.objects.get(pk=media_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user