diff --git a/packages/django-dramatiq-postgres/django_dramatiq_postgres/broker.py b/packages/django-dramatiq-postgres/django_dramatiq_postgres/broker.py index 35aa8cd7ff..5c283610a1 100644 --- a/packages/django-dramatiq-postgres/django_dramatiq_postgres/broker.py +++ b/packages/django-dramatiq-postgres/django_dramatiq_postgres/broker.py @@ -465,7 +465,7 @@ class _PostgresConsumer(Consumer): self.logger.debug("Running garbage collector") count = self.query_set.filter( state__in=(TaskState.DONE, TaskState.REJECTED), - mtime__lte=timezone.now() - timedelta(seconds=Conf().task_purge_interval), + mtime__lte=timezone.now() - timedelta(seconds=Conf().task_expiration), result_expiry__lte=timezone.now(), ).delete() self.logger.info("Purged messages in all queues", count=count)