mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 01:26:47 +01:00
force flush on temp file during consumption
file.write() does not guarantee that a file handle contains anything without calling an accompanying file.flush() For typical files that are larger than the OS-file buffer, this is no problem For small files (e.g. 64 characters in a .TXT), this race condition leads to `inode/x-empty` because the file inode is created, but no content is written to it
This commit is contained in:
parent
29ce2515ee
commit
21c501de28
2 changed files with 2 additions and 5 deletions
|
|
@ -383,6 +383,7 @@ class PostDocumentView(APIView):
|
|||
dir=settings.SCRATCH_DIR,
|
||||
delete=False) as f:
|
||||
f.write(doc_data)
|
||||
f.flush()
|
||||
os.utime(f.name, times=(t, t))
|
||||
|
||||
async_task("documents.tasks.consume_file",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue