From d0252e8e44a930b9c9ef9ba3b7f7d3a25b2160d3 Mon Sep 17 00:00:00 2001 From: Daniel Quinn Date: Sat, 3 Mar 2018 18:42:41 +0000 Subject: [PATCH] Run a --oneshot loop twice This was necessary since the first loop only ever collects file statistics so that the second run can be sure about "readiness". --- src/documents/management/commands/document_consumer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index dbd7e3264..f94265b65 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -99,5 +99,7 @@ class Command(BaseCommand): self.first_iteration = False self.mail_fetcher.pull() - # Consume whatever files we can - self.file_consumer.run() + # Consume whatever files we can. + # We have to run twice as the first run checks for file readiness + for i in range(2): + self.file_consumer.run()