mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
Always close the Inotify instance
This commit is contained in:
parent
c7eaf21c11
commit
4ce418a900
@ -294,9 +294,9 @@ class Command(BaseCommand):
|
|||||||
inotify = INotify()
|
inotify = INotify()
|
||||||
inotify_flags = flags.CLOSE_WRITE | flags.MOVED_TO | flags.MODIFY
|
inotify_flags = flags.CLOSE_WRITE | flags.MOVED_TO | flags.MODIFY
|
||||||
if recursive:
|
if recursive:
|
||||||
descriptor = inotify.add_watch_recursive(directory, inotify_flags)
|
inotify.add_watch_recursive(directory, inotify_flags)
|
||||||
else:
|
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_secs: Final[float] = settings.CONSUMER_INOTIFY_DELAY
|
||||||
inotify_debounce_ms: Final[int] = inotify_debounce_secs * 1000
|
inotify_debounce_ms: Final[int] = inotify_debounce_secs * 1000
|
||||||
@ -305,6 +305,7 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
notified_files = {}
|
notified_files = {}
|
||||||
|
|
||||||
|
try:
|
||||||
while not finished:
|
while not finished:
|
||||||
try:
|
try:
|
||||||
for event in inotify.read(timeout=timeout_ms):
|
for event in inotify.read(timeout=timeout_ms):
|
||||||
@ -355,5 +356,4 @@ class Command(BaseCommand):
|
|||||||
logger.info("Received SIGINT, stopping inotify")
|
logger.info("Received SIGINT, stopping inotify")
|
||||||
finished = True
|
finished = True
|
||||||
finally:
|
finally:
|
||||||
inotify.rm_watch(descriptor)
|
|
||||||
inotify.close()
|
inotify.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user