Skip to content

Commit

Permalink
Warn if consume directory contains subdirectories
Browse files Browse the repository at this point in the history
.
  • Loading branch information
bauerj committed Jan 4, 2020
1 parent a690b1c commit 22c7f30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/documents/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def consume_new_files(self):
ignored_files.append(file)
else:
files.append(file)
else:
self.logger.warning(
"Skipping %s as it is not a file",
entry.path
)

if not files:
return
Expand Down
6 changes: 6 additions & 0 deletions src/documents/management/commands/document_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Command(BaseCommand):
def __init__(self, *args, **kwargs):

self.verbosity = 0
self.logger = logging.getLogger(__name__)

self.file_consumer = None
self.mail_fetcher = None
Expand Down Expand Up @@ -138,6 +139,11 @@ def loop_inotify(self, mail_delta):
file = os.path.join(directory, event.name)
if os.path.isfile(file):
self.file_consumer.try_consume_file(file)
else:
self.logger.warning(
"Skipping %s as it is not a file",
file
)
else:
break

Expand Down

0 comments on commit 22c7f30

Please sign in to comment.