mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06: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:
		@@ -29,9 +29,9 @@
 | 
			
		||||
          document:
 | 
			
		||||
            content: "{{ content }}"
 | 
			
		||||
            filename: "{{ filename }}.txt"
 | 
			
		||||
            mime_type: text/plain
 | 
			
		||||
        headers:
 | 
			
		||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
			
		||||
          Content-Type: text/plain
 | 
			
		||||
        return_content: yes
 | 
			
		||||
      register: post_document
 | 
			
		||||
      failed_when: "'OK' not in post_document.content"
 | 
			
		||||
@@ -45,10 +45,6 @@
 | 
			
		||||
      register: logs
 | 
			
		||||
      failed_when: "('Consuming ' + filename + '.txt') not in logs.content"
 | 
			
		||||
 | 
			
		||||
    - name: sleep 5 seconds
 | 
			
		||||
      pause:
 | 
			
		||||
        seconds: 5
 | 
			
		||||
 | 
			
		||||
    - name: verify uploaded document has been consumed
 | 
			
		||||
      uri:
 | 
			
		||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/logs/"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user