From 3ce98305f0995b56e4d36bb31c2fdae2f858bcaa Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 17 Mar 2021 23:21:52 +0100 Subject: [PATCH] Support for on_moved handler on file/log monitor backends --- platypush/backend/file/monitor/entities/handlers.py | 3 +++ platypush/backend/log/http.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/platypush/backend/file/monitor/entities/handlers.py b/platypush/backend/file/monitor/entities/handlers.py index 76d9f50cd1..738bca56b5 100644 --- a/platypush/backend/file/monitor/entities/handlers.py +++ b/platypush/backend/file/monitor/entities/handlers.py @@ -25,6 +25,9 @@ class EventHandler(FileSystemEventHandler): def on_modified(self, event): get_bus().post(FileSystemModifyEvent(path=event.src_path, is_directory=event.is_directory)) + def on_moved(self, event): + pass + @classmethod def from_resource(cls, resource: MonitoredResource): if isinstance(resource, MonitoredPattern): diff --git a/platypush/backend/log/http.py b/platypush/backend/log/http.py index 18bab411cf..6ae76d2230 100644 --- a/platypush/backend/log/http.py +++ b/platypush/backend/log/http.py @@ -50,6 +50,9 @@ class LogEventHandler(EventHandler): def on_deleted(self, event): self._reset_file(event.src_path) + def on_moved(self, event): + self._reset_file(event.src_path) + def _reset_file(self, path: str): file_info = self._monitored_files.get(path) if not file_info: