Rename MycroftSkill.shutdown to MycroftSkill._shutdown
This removes the need for skills to call Super(MySkill, self).shutdown()pull/1519/head
parent
10bd9a1cf3
commit
fa11ac7dbe
|
@ -88,7 +88,7 @@ class SkillContainer(object):
|
|||
|
||||
def stop(self):
|
||||
if self.skill:
|
||||
self.skill.shutdown()
|
||||
self.skill._shutdown()
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -882,6 +882,11 @@ class MycroftSkill(object):
|
|||
process termination. The skill implementation must
|
||||
shutdown all processes and operations in execution.
|
||||
"""
|
||||
pass
|
||||
|
||||
def _shutdown(self):
|
||||
"""Parent function called internally to shut down everything"""
|
||||
self.shutdown()
|
||||
# Store settings
|
||||
self.settings.store()
|
||||
self.settings.is_alive = False
|
||||
|
@ -1154,9 +1159,9 @@ class FallbackSkill(MycroftSkill):
|
|||
handler = self.instance_fallback_handlers.pop()
|
||||
self.remove_fallback(handler)
|
||||
|
||||
def shutdown(self):
|
||||
def _shutdown(self):
|
||||
"""
|
||||
Remove all registered handlers and perform skill shutdown.
|
||||
"""
|
||||
self.remove_instance_handlers()
|
||||
super(FallbackSkill, self).shutdown()
|
||||
super(FallbackSkill, self)._shutdown()
|
||||
|
|
|
@ -378,7 +378,7 @@ class SkillManager(Thread):
|
|||
LOG.debug("Reloading Skill: " + skill_folder)
|
||||
# removing listeners and stopping threads
|
||||
try:
|
||||
skill["instance"].shutdown()
|
||||
skill["instance"]._shutdown()
|
||||
except Exception:
|
||||
LOG.exception("An error occured while shutting down {}"
|
||||
.format(skill["instance"].name))
|
||||
|
@ -503,7 +503,7 @@ class SkillManager(Thread):
|
|||
instance = skill_info.get('instance')
|
||||
if instance:
|
||||
try:
|
||||
instance.shutdown()
|
||||
instance._shutdown()
|
||||
except Exception:
|
||||
LOG.exception('Shutting down skill: ' + name)
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ def load_skills(emitter, skills_root):
|
|||
|
||||
def unload_skills(skills):
|
||||
for s in skills:
|
||||
s.shutdown()
|
||||
s._shutdown()
|
||||
|
||||
|
||||
class RegistrationOnlyEmitter(object):
|
||||
|
|
Loading…
Reference in New Issue