mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Includes the actual OSError string in the log, instead of assuming it's a busy file
This commit is contained in:
		
							parent
							
								
									0bb9d91eae
								
							
						
					
					
						commit
						3aca576a0d
					
				@ -67,17 +67,19 @@ def _consume(filepath):
 | 
			
		||||
 | 
			
		||||
    read_try_count = 0
 | 
			
		||||
    file_open_ok = False
 | 
			
		||||
    os_error_str = None
 | 
			
		||||
 | 
			
		||||
    while (read_try_count < os_error_retry_count) and not file_open_ok:
 | 
			
		||||
        try:
 | 
			
		||||
            with open(filepath, "rb"):
 | 
			
		||||
                file_open_ok = True
 | 
			
		||||
        except OSError:
 | 
			
		||||
        except OSError as e:
 | 
			
		||||
            read_try_count += 1
 | 
			
		||||
            os_error_str = str(e)
 | 
			
		||||
            sleep(os_error_retry_wait)
 | 
			
		||||
 | 
			
		||||
    if read_try_count >= os_error_retry_count:
 | 
			
		||||
        logger.warning(f"Not consuming file {filepath}: OS reports file as busy still")
 | 
			
		||||
        logger.warning(f"Not consuming file {filepath}: OS reports {os_error_str}")
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    tag_ids = None
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user