Consume documents in order of increasing mtime

This increases overall usability, especially for multi-page scans.
Previously, the consumption order was undefined (see os.listdir())
This commit is contained in:
Erik Arvstedt 2018-05-11 14:01:13 +02:00
parent 873c98dddb
commit 2fe7df8ca0

View File

@ -71,8 +71,11 @@ class Consumer:
})
def run(self):
docs = [os.path.join(self.consume, entry)
for entry in os.listdir(self.consume)]
docs_old_to_new = sorted(docs, key=lambda doc: os.path.getmtime(doc))
for doc in os.listdir(self.consume):
for doc in docs_old_to_new:
doc = os.path.join(self.consume, doc)