Skip to content

Commit

Permalink
work in progress for moving inotify to watchdog, see #168
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Apr 3, 2023
1 parent 36dba45 commit 472b21e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions shared/bin/watch_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def on_created(self, event):
self.on_modified(event)

def on_modified(self, event):
# we only care about "created" and "modified" events if polling,
# otherwise "on_closed" will take care of us
if not event.is_directory and self.polling:
if not event.is_directory:
with self.deck as d:
d[event.src_path] = self.nowTime
d.move_to_end(event.src_path, last=True)
Expand Down Expand Up @@ -128,7 +126,12 @@ def ProcessFileEventWorker(workerArgs):
else:
del d[fileName]
if fileProcessor is not None:
fileProcessor(fileName, func(**fileProcessorKwargs))
fileProcessor(
fileName,
**fileProcessorKwargs
if fileProcessorKwargs and isinstance(fileProcessorKwargs, dict)
else {},
)
if logger is not None:
logger.debug(
f"processed {fileName} at {(nowTime-eventTime) if (eventTime > 0) else 0} seconds"
Expand Down

0 comments on commit 472b21e

Please sign in to comment.