Skip to content

Commit

Permalink
run startup async to avoid freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoy-at-pieces committed Dec 12, 2024
1 parent dbae27d commit 502e4d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ def startup():
def plugin_loaded():
# Use the auth callback instead of the default one in the client
PiecesSettings.api_client.user.on_user_callback = AuthUser.on_user_callback
sublime.set_timeout_async(run_async)


def run_async():
settings = PiecesSettings.get_settings()
host = settings.get("host")

PiecesSettings.host_init(host) # Intilize the hosts url
# callbacks needed onchange settings
PiecesSettings.on_model_change_callbacks.append(copilot.update_status_bar)
health_ws = HealthWS(PiecesSettings.api_client, lambda x:startup())
health = PiecesSettings.api_client.is_pieces_running()
if PiecesSettings.get_settings().get("auto_start_pieces_os"):
health = PiecesSettings.api_client.open_pieces_os()

health_ws = HealthWS(PiecesSettings.api_client, lambda x:startup())
if health:
health_ws.start()
else:
Expand Down

0 comments on commit 502e4d1

Please sign in to comment.