Refresh the instance from the database before doing any file handling with it

This commit is contained in:
Trenton H
2022-10-31 15:30:56 -07:00
committed by Trenton H
parent 3c325582d9
commit 7e3e0a0fa6
3 changed files with 32 additions and 1 deletions

View File

@@ -405,6 +405,7 @@ class Consumer(LoggingMixin):
# Don't save with the lock active. Saving will cause the file
# renaming logic to acquire the lock as well.
# This triggers things like file renaming
document.save()
# Delete the file only if it was successfully consumed
@@ -438,6 +439,9 @@ class Consumer(LoggingMixin):
self._send_progress(100, 100, "SUCCESS", MESSAGE_FINISHED, document.id)
# Return the most up to date fields
document.refresh_from_db()
return document
def _store(self, text, date, mime_type) -> Document: