From 6b36929f5d83cb461d165739c53195945302f110 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Thu, 29 Aug 2024 11:31:21 -0500 Subject: [PATCH] Always update status when user opens connection (#7) --- src/controllers/ConnectionController.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/controllers/ConnectionController.ts b/src/controllers/ConnectionController.ts index 41dd8f64..c0d0f1db 100644 --- a/src/controllers/ConnectionController.ts +++ b/src/controllers/ConnectionController.ts @@ -228,11 +228,20 @@ export class ConnectionController implements Disposable { const editor = vscode.window.activeTextEditor; - // In case this is called before the server manager has checked server - // statuses, we want to make sure at least one check for running servers is - // done. + const updateStatusPromise = this._serverManager.updateStatus(); + + // We always update status when the user is prompted to select a connection, + // but we only block if this is the first time we're updating status. For the + // most common use cases, other events will trigger the status update before + // the user attempts to see the available servers (see handlers in + // `ExtensionController.initializeServerUpdates`). One edge case is if the + // user is already in vscode while a server is starting / stopping, there + // may not be an event that proactively updates the status. Worst case + // scenario, the user will attempt to connect, see no server, then try again + // and see it. Alternatively, they can open the DH panel and explicitly refresh + // the server list. if (!this._serverManager.hasEverUpdatedStatus()) { - await this._serverManager.updateStatus(); + await updateStatusPromise; } const runningServersWithoutConnections = this._serverManager.getServers({