Skip to content

Commit

Permalink
Fixed issue with placeholder connection being removed too early (DH-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Dec 5, 2024
1 parent a89e6ad commit 5a4078f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/services/ServerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ export class ServerManager implements IServerManager {

let tagId: UniqueID | undefined;

let placeholderUrl: URL | undefined;

// Pip managed local server
if (serverState.isManaged) {
this.updateConnectionCount(serverUrl, 1);
Expand All @@ -199,10 +201,7 @@ export class ServerManager implements IServerManager {
tagId = uniqueId();

// Put a placeholder connection in place until the worker is ready.
const placeholderUrl = this.addWorkerPlaceholderConnection(
serverUrl,
tagId
);
placeholderUrl = this.addWorkerPlaceholderConnection(serverUrl, tagId);

let workerInfo: WorkerInfo;
try {
Expand All @@ -227,9 +226,6 @@ export class ServerManager implements IServerManager {
return null;
}

// Remove placeholder connection
this.removeWorkerPlaceholderConnection(placeholderUrl);

// Map the worker URL to the server URL to make things easier to dispose
// later.
this._workerURLToServerURLMap.set(new URL(workerInfo.grpcUrl), serverUrl);
Expand All @@ -242,7 +238,14 @@ export class ServerManager implements IServerManager {
const connection = this._dhcServiceFactory.create(serverUrl, tagId);

// Initialize client + prompt for login if necessary
if (!(await connection.getClient())) {
const isClientConnected = await connection.getClient();

// Cleanup placeholder connection if one exists
if (placeholderUrl) {
this.removeWorkerPlaceholderConnection(placeholderUrl);
}

if (!isClientConnected) {
return null;
}

Expand Down

0 comments on commit 5a4078f

Please sign in to comment.