From cfcd5ab49cff749af590e51eecffd71e870f80cd Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 20 Jun 2024 22:06:15 +0100 Subject: [PATCH] refactor/logs better logs when fallback is killed, so the AbortEvent doesnt scare users ``` 2024-06-20 22:04:41.292 - skills - ovos_core.intent_services.fallback_service:handle_ack:98 - INFO - ovos-skill-slow-fallback.openvoiceos will try to handle fallback 2024-06-20 22:04:41.336 - skills - ovos_core.intent_services.fallback_service:handle_ack:98 - INFO - skill-ovos-fallback-unknown.openvoiceos will try to handle fallback 2024-06-20 22:04:51.351 - skills - ovos_core.intent_services.fallback_service:attempt_fallback:156 - WARNING - ovos-skill-slow-fallback.openvoiceos took too long to answer, increasing "max_skill_runtime" in mycroft.conf might help alleviate this issue 2024-06-20 22:04:51.368 - skills - ovos_core.intent_services:handle_utterance:396 - DEBUG - intent matching took: 10.171107530593872 2024-06-20 22:04:51.373 - skills - ovos_bus_client.client.client:on_default_session_update:161 - DEBUG - synced default_session 2024-06-20 22:04:51.374 - skills - ovos_bus_client.client.client:on_default_session_update:161 - DEBUG - synced default_session 2024-06-20 22:04:51.374 - skills - ovos_workshop.skills.fallback:_handle_fallback_request:392 - DEBUG - fallback handler 'SlowFallbackSkill.handle_fallback' killed because it timed out! ``` --- ovos_workshop/skills/fallback.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ovos_workshop/skills/fallback.py b/ovos_workshop/skills/fallback.py index 68f6de43..416e54e0 100644 --- a/ovos_workshop/skills/fallback.py +++ b/ovos_workshop/skills/fallback.py @@ -23,7 +23,7 @@ from ovos_utils.metrics import Stopwatch from ovos_utils.skills import get_non_properties -from ovos_workshop.decorators.killable import killable_event +from ovos_workshop.decorators.killable import AbortEvent, killable_event from ovos_workshop.decorators.compat import backwards_compat from ovos_workshop.permissions import FallbackMode from ovos_workshop.skills.ovos import OVOSSkill @@ -382,12 +382,14 @@ def _handle_fallback_request(self, message: Message): key=operator.itemgetter(0)) for prio, handler in sorted_handlers: try: + handler_name = get_handler_name(handler) # call handler, conditionally activating the skill status = self._conditional_activate(handler, message=message) if status: # indicate completion - handler_name = get_handler_name(handler) break + except AbortEvent: + LOG.debug(f"fallback handler '{handler_name}' killed because it timed out!") except Exception: LOG.exception('Exception in fallback.') else: