Merge pull request #2613 from TTTPOB/fix/vscode-reuse-manager-output-channel
fix(vscode): reuse manager output channel across restarts
This commit is contained in:
@@ -15,6 +15,17 @@ import { applyProviderEnvAliases } from './provider-env-aliases';
|
||||
const t = vscode.l10n.t;
|
||||
|
||||
const READY_CHECK_TIMEOUT_MS = 30000;
|
||||
|
||||
// Reuse a single output channel across restarts instead of creating (and
|
||||
// leaking) a new one on every waitForReady call.
|
||||
let managerOutputChannel: vscode.OutputChannel | null = null;
|
||||
|
||||
function getManagerOutputChannel(): vscode.OutputChannel {
|
||||
if (!managerOutputChannel) {
|
||||
managerOutputChannel = vscode.window.createOutputChannel('OpenChamberManager');
|
||||
}
|
||||
return managerOutputChannel;
|
||||
}
|
||||
const WINDOWS_EXECUTABLE_EXTENSIONS = (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||
.split(';')
|
||||
.map((ext) => ext.trim().toLowerCase())
|
||||
@@ -613,7 +624,6 @@ async function waitForReady(
|
||||
timeoutMs = 15000,
|
||||
authHeaders: Record<string, string> = {}
|
||||
): Promise<ReadyResult> {
|
||||
const outputChannel = vscode.window.createOutputChannel('OpenChamberManager');
|
||||
const start = Date.now();
|
||||
const candidates = getCandidateBaseUrls(serverUrl);
|
||||
let attempts = 0;
|
||||
@@ -641,7 +651,7 @@ async function waitForReady(
|
||||
}
|
||||
|
||||
clearTimeout(timeout);
|
||||
outputChannel?.appendLine(
|
||||
getManagerOutputChannel().appendLine(
|
||||
`Health check to ${url.toString()} returned ${res.status} with body: ${JSON.stringify(body)}`
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user