Skip to content

Commit 40cb0f3

Browse files
committed
Increase initial connection timeout
1 parent bdcf7e1 commit 40cb0f3

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/vs/platform/remote/common/remoteAgentConnection.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async
1616
import { ILogService } from 'vs/platform/log/common/log';
1717
import { IIPCLogger } from 'vs/base/parts/ipc/common/ipc';
1818

19+
const INITIAL_CONNECT_TIMEOUT = 120 * 1000 /* 120s */;
20+
const RECONNECT_TIMEOUT = 30 * 1000 /* 30s */;
21+
1922
export const enum ConnectionType {
2023
Management = 1,
2124
ExtensionHost = 2,
@@ -277,7 +280,7 @@ export async function connectRemoteAgentManagement(options: IConnectionOptions,
277280
try {
278281
const reconnectionToken = generateUuid();
279282
const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null);
280-
const { protocol } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentManagement(simpleOptions), 30 * 1000 /*30s*/);
283+
const { protocol } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentManagement(simpleOptions), INITIAL_CONNECT_TIMEOUT);
281284
return new ManagementPersistentConnection(options, remoteAuthority, clientId, reconnectionToken, protocol);
282285
} catch (err) {
283286
options.logService.error(`[remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:`);
@@ -291,7 +294,7 @@ export async function connectRemoteAgentExtensionHost(options: IConnectionOption
291294
try {
292295
const reconnectionToken = generateUuid();
293296
const simpleOptions = await resolveConnectionOptions(options, reconnectionToken, null);
294-
const { protocol, debugPort } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentExtensionHost(simpleOptions, startArguments), 30 * 1000 /*30s*/);
297+
const { protocol, debugPort } = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentExtensionHost(simpleOptions, startArguments), INITIAL_CONNECT_TIMEOUT);
295298
return new ExtensionHostPersistentConnection(options, startArguments, reconnectionToken, protocol, debugPort);
296299
} catch (err) {
297300
options.logService.error(`[remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:`);
@@ -303,7 +306,7 @@ export async function connectRemoteAgentExtensionHost(options: IConnectionOption
303306

304307
export async function connectRemoteAgentTunnel(options: IConnectionOptions, tunnelRemotePort: number): Promise<PersistentProtocol> {
305308
const simpleOptions = await resolveConnectionOptions(options, generateUuid(), null);
306-
const protocol = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentTunnel(simpleOptions, { port: tunnelRemotePort }), 30 * 1000 /*30s*/);
309+
const protocol = await connectWithTimeLimit(simpleOptions.logService, doConnectRemoteAgentTunnel(simpleOptions, { port: tunnelRemotePort }), INITIAL_CONNECT_TIMEOUT);
307310
return protocol;
308311
}
309312

@@ -434,7 +437,7 @@ abstract class PersistentConnection extends Disposable {
434437
this._options.logService.info(`${logPrefix} resolving connection...`);
435438
const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
436439
this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
437-
await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), 30 * 1000 /*30s*/);
440+
await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
438441
this._options.logService.info(`${logPrefix} reconnected!`);
439442
this._onDidStateChange.fire(new ConnectionGainEvent());
440443

0 commit comments

Comments
 (0)