diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index 36dcc7706..0e8e88b45 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -354,6 +354,6 @@ class Command(BaseCommand): except KeyboardInterrupt: logger.info("Received SIGINT, stopping inotify") finished = True - - inotify.rm_watch(descriptor) - inotify.close() + finally: + inotify.rm_watch(descriptor) + inotify.close()