From fd29e45e1950f987d728462979d64eca844430ae Mon Sep 17 00:00:00 2001 From: Rebecca Cremona Date: Wed, 25 Oct 2023 15:26:52 -0400 Subject: [PATCH] If something goes wrong with the task count, alert the error log. --- perma_web/perma/celery_tasks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/perma_web/perma/celery_tasks.py b/perma_web/perma/celery_tasks.py index 420b4d16f..3f34f2fae 100644 --- a/perma_web/perma/celery_tasks.py +++ b/perma_web/perma/celery_tasks.py @@ -2462,6 +2462,10 @@ def conditionally_queue_internet_archive_uploads_for_date_range(start_date_strin max_to_queue = settings.INTERNET_ARCHIVE_MAX_SIMULTANEOUS_UPLOADS - tasks_in_flight to_queue = min(max_to_queue, limit) if limit else max_to_queue + if to_queue < 0: + logger.error(f"Something is amiss with the IA upload process: InternetArchiveItem.inflight_task_count ({InternetArchiveItem.inflight_task_count()}) is larger than settings.INTERNET_ARCHIVE_MAX_SIMULTANEOUS_UPLOADS.") + return + if to_queue: total_queued = 0