Browse Source

Source code reloader only once in every 5 seconds

shortcutme 5 years ago
parent
commit
55e2a2fd5d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/Debug/DebugReloader.py

+ 3 - 2
src/Debug/DebugReloader.py

@@ -42,9 +42,10 @@ class DebugReloader:
             not evt.path or "%s/" % config.data_dir in evt.path or
             (not evt.path.endswith("py") and not evt.path.endswith("json")) or
             "Test" in evt.path or
-            time.time() - self.last_chaged < 1
+            time.time() - self.last_chaged < 5.0
         ):
             return False  # Ignore *.pyc changes and no reload within 1 sec
+        self.last_chaged = time.time()
+        logging.debug("File changed: %s, cb: %s reloading source code" % (evt.path, self.callback))
         time.sleep(0.1)  # Wait for lock release
         self.callback()
-        self.last_chaged = time.time()