Using while instead of recursive function
@@ -82,6 +82,7 @@ def clear_skill_events(instance):
def watch_skills():
global ws, loaded_skills, last_modified_skill, skills_directories
+ while True:
for dir in skills_directories:
if exists(dir):
list = filter(lambda x: os.path.isdir(os.path.join(dir, x)),
@@ -97,9 +98,11 @@ def watch_skills():
os.path.getmtime(root) for root, _, _ in
os.walk(skill["path"]))
modified = skill.get("last_modified", 0)
- if skill.get("instance") and modified <= last_modified_skill:
+ if skill.get(
+ "instance") and modified <= last_modified_skill:
continue
- elif skill.get("instance") and modified > last_modified_skill:
+ elif skill.get(
+ "instance") and modified > last_modified_skill:
logger.debug("Reloading Skill: " + skill_folder)
skill["instance"].shutdown()
clear_skill_events(skill["instance"])
@@ -109,7 +112,6 @@ def watch_skills():
last_modified_skill = max(
map(lambda x: x.get("last_modified"), loaded_skills.values()))
time.sleep(2)
- watch_skills()
def main():
