diff --git a/lib/tfw/components/directory_monitor.py b/lib/tfw/components/directory_monitor.py index 627fb31..9feb46d 100644 --- a/lib/tfw/components/directory_monitor.py +++ b/lib/tfw/components/directory_monitor.py @@ -1,4 +1,4 @@ -from time import time +from time import time, sleep from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler @@ -17,7 +17,7 @@ class WebideReloadEventHandler(FileSystemEventHandler): self.last_call = time() def on_modified(self, event): - if self.limit_rate(): return + self.limit_rate() log.debug(event) anchor = 'anchor_webide' @@ -28,7 +28,8 @@ class WebideReloadEventHandler(FileSystemEventHandler): since_last_call = time() - self.last_call to_next_call = self.min_interval - since_last_call self.last_call = time() - return to_next_call > 0 + if to_next_call > 0: + sleep(to_next_call) class DirectoryMonitor: