mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 17:17:26 +01:00
Corrects the timeout's interaction with files waiting to be consumed
This commit is contained in:
parent
86358d5561
commit
ad1f5ae081
2 changed files with 10 additions and 2 deletions
|
|
@ -248,7 +248,7 @@ class Command(BaseCommand):
|
|||
|
||||
while not finished:
|
||||
try:
|
||||
for event in inotify.read(timeout):
|
||||
for event in inotify.read(timeout=timeout):
|
||||
if recursive:
|
||||
path = inotify.get_path(event.wd)
|
||||
else:
|
||||
|
|
@ -281,6 +281,15 @@ class Command(BaseCommand):
|
|||
# These files are still waiting to hit the timeout
|
||||
notified_files = still_waiting
|
||||
|
||||
# If files are waiting, need to exit read() to check them
|
||||
# Otherwise, go back to infinite sleep time, but only if not testing
|
||||
if len(notified_files) > 0:
|
||||
timeout = inotify_debounce
|
||||
elif is_testing:
|
||||
timeout = self.testing_timeout_ms
|
||||
else:
|
||||
timeout = None
|
||||
|
||||
if self.stop_flag.is_set():
|
||||
logger.debug("Finishing because event is set")
|
||||
finished = True
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import filecmp
|
|||
import os
|
||||
import shutil
|
||||
from threading import Thread
|
||||
from time import monotonic
|
||||
from time import sleep
|
||||
from unittest import mock
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue