From 6b9e380d424469b9adfc10704ebdf527b1800ef2 Mon Sep 17 00:00:00 2001 From: JarbasAi Date: Thu, 20 Apr 2023 01:48:03 +0100 Subject: [PATCH] refactor/skill_loader_from_workshop companion to https://github.com/OpenVoiceOS/OVOS-workshop/pull/65 --- mycroft/skills/skill_loader.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mycroft/skills/skill_loader.py b/mycroft/skills/skill_loader.py index 8ef4a8f594d..971977b1829 100644 --- a/mycroft/skills/skill_loader.py +++ b/mycroft/skills/skill_loader.py @@ -15,6 +15,7 @@ """Periodically run by skill manager to load skills into memory.""" import os from time import time +from ovos_utils.log import LOG # backwards compat imports do not delete from ovos_plugin_manager.skills import find_skill_plugins @@ -79,6 +80,21 @@ def __init__(self, bus, skill_directory=None): self.last_modified = 0 self.modtime_error_log_written = False + def _handle_filechange(self): + super()._handle_filechange() + # NOTE: below could be removed, but is kept for api backwards compatibility + # users of SkillLoader will still have all properties properly updated + # TODO on ntp sync last_modified needs to be updated + try: + self.last_modified = _get_last_modified_time(self.skill_directory) + except OSError as err: + self.last_modified = self.last_loaded + if not self.modtime_error_log_written: + self.modtime_error_log_written = True + LOG.error(f'Failed to get last_modification time ({err})') + else: + self.modtime_error_log_written = False + def reload_needed(self): """DEPRECATED: backwards compatibility only