Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor skills status check to resolve init bug #31

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,6 @@ def __init__(self, core_bus: MessageBusClient):
self._init_gui_file_share()
self._define_message_handlers()

resp = self.core_bus.wait_for_response(Message("mycroft.skills.is_ready",
context={"source": "gui", "destination": ["skills"]}))
if resp and resp.data.get("status"):
LOG.debug("Skills service already running")
self.handle_ready()

@property
def _active_homescreen(self) -> str:
return Configuration().get('gui', {}).get('idle_display_skill')
Expand Down Expand Up @@ -512,7 +506,7 @@ def _define_message_handlers(self):
self.core_bus.on("gui.page_gained_focus", self.handle_page_gained_focus)
self.core_bus.on("mycroft.skills.trained", self.handle_ready)

def handle_ready(self, message=None):
def handle_ready(self, message):
self._ready_event.set()
self.core_bus.on("gui.volunteer_page_upload",
self.handle_gui_pages_available)
Expand Down
11 changes: 10 additions & 1 deletion ovos_gui/service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ovos_bus_client import MessageBusClient
from ovos_bus_client import MessageBusClient, Message
from ovos_utils.log import LOG
from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap, ProcessState
from ovos_config.config import Configuration
Expand Down Expand Up @@ -60,6 +60,15 @@ def run(self):
# if they may cause the Service to fail.
self.status.set_alive()
self._init_bus_client()

# Bus is connected, check if the skills service is ready
resp = self.bus.wait_for_response(
Message("mycroft.skills.is_ready",
context={"source": "gui", "destination": ["skills"]}))
if resp and resp.data.get("status"):
LOG.debug("Skills service already running")
self.gui.handle_ready(resp)

self.extension_manager = ExtensionsManager("EXTENSION_SERVICE",
self.bus, self.gui)
self.status.set_ready()
Expand Down
Loading