Source code reloader only once in every 5 seconds
This commit is contained in:
parent
eecc257822
commit
55e2a2fd5d
1 changed files with 3 additions and 2 deletions
|
@ -42,9 +42,10 @@ class DebugReloader:
|
||||||
not evt.path or "%s/" % config.data_dir in evt.path or
|
not evt.path or "%s/" % config.data_dir in evt.path or
|
||||||
(not evt.path.endswith("py") and not evt.path.endswith("json")) or
|
(not evt.path.endswith("py") and not evt.path.endswith("json")) or
|
||||||
"Test" in evt.path 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
|
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
|
time.sleep(0.1) # Wait for lock release
|
||||||
self.callback()
|
self.callback()
|
||||||
self.last_chaged = time.time()
|
|
||||||
|
|
Loading…
Reference in a new issue