mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-07 23:35:22 +01:00
Fix: Always clean up INotify (#9359)
This commit is contained in:
parent
169aa8c8bd
commit
f4413e0a08
1 changed files with 50 additions and 50 deletions
|
|
@ -294,9 +294,9 @@ class Command(BaseCommand):
|
|||
inotify = INotify()
|
||||
inotify_flags = flags.CLOSE_WRITE | flags.MOVED_TO | flags.MODIFY
|
||||
if recursive:
|
||||
descriptor = inotify.add_watch_recursive(directory, inotify_flags)
|
||||
inotify.add_watch_recursive(directory, inotify_flags)
|
||||
else:
|
||||
descriptor = inotify.add_watch(directory, inotify_flags)
|
||||
inotify.add_watch(directory, inotify_flags)
|
||||
|
||||
inotify_debounce_secs: Final[float] = settings.CONSUMER_INOTIFY_DELAY
|
||||
inotify_debounce_ms: Final[int] = inotify_debounce_secs * 1000
|
||||
|
|
@ -305,6 +305,7 @@ class Command(BaseCommand):
|
|||
|
||||
notified_files = {}
|
||||
|
||||
try:
|
||||
while not finished:
|
||||
try:
|
||||
for event in inotify.read(timeout=timeout_ms):
|
||||
|
|
@ -354,6 +355,5 @@ class Command(BaseCommand):
|
|||
except KeyboardInterrupt:
|
||||
logger.info("Received SIGINT, stopping inotify")
|
||||
finished = True
|
||||
|
||||
inotify.rm_watch(descriptor)
|
||||
finally:
|
||||
inotify.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue