mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-17 10:13:56 -05:00
Corrects the timeout's interaction with files waiting to be consumed
This commit is contained in:
parent
86358d5561
commit
ad1f5ae081
@ -248,7 +248,7 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
while not finished:
|
while not finished:
|
||||||
try:
|
try:
|
||||||
for event in inotify.read(timeout):
|
for event in inotify.read(timeout=timeout):
|
||||||
if recursive:
|
if recursive:
|
||||||
path = inotify.get_path(event.wd)
|
path = inotify.get_path(event.wd)
|
||||||
else:
|
else:
|
||||||
@ -281,6 +281,15 @@ class Command(BaseCommand):
|
|||||||
# These files are still waiting to hit the timeout
|
# These files are still waiting to hit the timeout
|
||||||
notified_files = still_waiting
|
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():
|
if self.stop_flag.is_set():
|
||||||
logger.debug("Finishing because event is set")
|
logger.debug("Finishing because event is set")
|
||||||
finished = True
|
finished = True
|
||||||
|
@ -2,7 +2,6 @@ import filecmp
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import monotonic
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user