From dd0dd39bf05620f9794fe8a1e52d1cae9a9603d3 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 3 Jun 2016 22:14:14 -0400 Subject: [PATCH] Fix the queue cleanup worker to delete the items that have expired, not unexpired --- workers/queuecleanupworker.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/workers/queuecleanupworker.py b/workers/queuecleanupworker.py index 8bd8713e3..2e453f3d0 100644 --- a/workers/queuecleanupworker.py +++ b/workers/queuecleanupworker.py @@ -21,11 +21,10 @@ class QueueCleanupWorker(Worker): """ Performs garbage collection on the queueitem table. """ with UseThenDisconnect(app.config): while True: - # Find all queue items older than the threshold (typically a week) that have no additional - # retries and delete them. + # Find all queue items older than the threshold (typically a week) and delete them. threshold_ago = datetime.now() - DELETION_DATE_THRESHOLD - to_delete = list(QueueItem.select().where(QueueItem.processing_expires >= threshold_ago, - QueueItem.retries_remaining == 0) + to_delete = list(QueueItem.select() + .where(QueueItem.processing_expires <= threshold_ago) .limit(BATCH_SIZE)) if len(to_delete) < DELETION_COUNT_THRESHOLD: