Skip to content

Commit

Permalink
Merge pull request #51 from MycroftAI/bugfix/init-recursion
Browse files Browse the repository at this point in the history
Fix infinite recursion issue
  • Loading branch information
forslund committed Aug 23, 2019
2 parents 9a2eee9 + 3bccd4d commit 79d283b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion msm/mycroft_skills_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def _merge_remote_with_local(self, remote_skills):
"""Merge the skills found in the repo with those installed locally."""
all_skills = []
for skill_file in glob(path.join(self.skills_dir, '*', '__init__.py')):
skill = SkillEntry.from_folder(path.dirname(skill_file), msm=self)
skill = SkillEntry.from_folder(path.dirname(skill_file), msm=self,
use_cache=False)
if skill.id in remote_skills:
skill.attach(remote_skills.pop(skill.id))
all_skills.append(skill)
Expand Down
11 changes: 6 additions & 5 deletions msm/skill_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,16 @@ def attach(self, remote_entry):
return self

@classmethod
def from_folder(cls, path, msm=None):
def from_folder(cls, path, msm=None, use_cache=True):
"""Find or create skill entry from folder path.
Arguments:
path: path of skill folder
msm: msm instance to use for caching and extended information
retrieval.
path: path of skill folder
msm: msm instance to use for caching and extended information
retrieval.
use_cache: Enable/Disable cache usage. defaults to True
"""
if msm:
if msm and use_cache:
skills = {skill.path: skill for skill in msm.local_skills.values()}
if path in skills:
return skills[path]
Expand Down

0 comments on commit 79d283b

Please sign in to comment.