This can be any model, not just media
This commit is contained in:
@@ -233,7 +233,7 @@ def schedule_media_servers_update():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def wait_for_errors(media, /, tn='sync.tasks.download_media_metadata'):
|
def wait_for_errors(model, /, tn='sync.tasks.download_media_metadata'):
|
||||||
window = timezone.timedelta(hours=3) + timezone.now()
|
window = timezone.timedelta(hours=3) + timezone.now()
|
||||||
tqs = Task.objects.filter(
|
tqs = Task.objects.filter(
|
||||||
task_name=tn,
|
task_name=tn,
|
||||||
@@ -242,7 +242,7 @@ def wait_for_errors(media, /, tn='sync.tasks.download_media_metadata'):
|
|||||||
run_at__lte=window,
|
run_at__lte=window,
|
||||||
last_error__contains='HTTPError 429: Too Many Requests',
|
last_error__contains='HTTPError 429: Too Many Requests',
|
||||||
)
|
)
|
||||||
task = get_first_task(tn, instance=media)
|
task = get_first_task(tn, instance=model)
|
||||||
update_task_status(task, 'paused (429)')
|
update_task_status(task, 'paused (429)')
|
||||||
time.sleep(10 * tqs.count())
|
time.sleep(10 * tqs.count())
|
||||||
update_task_status(task, None)
|
update_task_status(task, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user