mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	Handle when INotify fails to import but the polling is set to 0 still (#4230)
This commit is contained in:
		
							parent
							
								
									1ce0eae931
								
							
						
					
					
						commit
						085e6da1f2
					
				@ -245,6 +245,8 @@ class Command(BaseCommand):
 | 
				
			|||||||
        if settings.CONSUMER_POLLING == 0 and INotify:
 | 
					        if settings.CONSUMER_POLLING == 0 and INotify:
 | 
				
			||||||
            self.handle_inotify(directory, recursive, options["testing"])
 | 
					            self.handle_inotify(directory, recursive, options["testing"])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
 | 
					            if INotify is None and settings.CONSUMER_POLLING == 0:  # pragma: no cover
 | 
				
			||||||
 | 
					                logger.warn("Using polling as INotify import failed")
 | 
				
			||||||
            self.handle_polling(directory, recursive, options["testing"])
 | 
					            self.handle_polling(directory, recursive, options["testing"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        logger.debug("Consumer exiting.")
 | 
					        logger.debug("Consumer exiting.")
 | 
				
			||||||
@ -257,8 +259,14 @@ class Command(BaseCommand):
 | 
				
			|||||||
            timeout = self.testing_timeout_s
 | 
					            timeout = self.testing_timeout_s
 | 
				
			||||||
            logger.debug(f"Configuring timeout to {timeout}s")
 | 
					            logger.debug(f"Configuring timeout to {timeout}s")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        polling_interval = settings.CONSUMER_POLLING
 | 
				
			||||||
 | 
					        if polling_interval == 0:  # pragma: no cover
 | 
				
			||||||
 | 
					            # Only happens if INotify failed to import
 | 
				
			||||||
 | 
					            logger.warn("Using polling of 10s, consider settng this")
 | 
				
			||||||
 | 
					            polling_interval = 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with ThreadPoolExecutor(max_workers=4) as pool:
 | 
					        with ThreadPoolExecutor(max_workers=4) as pool:
 | 
				
			||||||
            observer = PollingObserver(timeout=settings.CONSUMER_POLLING)
 | 
					            observer = PollingObserver(timeout=polling_interval)
 | 
				
			||||||
            observer.schedule(Handler(pool), directory, recursive=recursive)
 | 
					            observer.schedule(Handler(pool), directory, recursive=recursive)
 | 
				
			||||||
            observer.start()
 | 
					            observer.start()
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user