// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. import { CancellationTokenSource } from "vscode"; import { PromiseUtil } from "../../common/node/promise"; import { Request } from "../../common/node/request"; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface IConfig {} export async function downloadConfig( endpointURL: string, ): Promise { const resString = await Request.request(endpointURL, false, true); return JSON.parse(resString); } export async function retryDownloadConfig( endpointURL: string, cancellationTokenSource: CancellationTokenSource, retryCount = 60, ): Promise { return PromiseUtil.retryAsync( async () => { try { return (await downloadConfig(endpointURL)) as T; } catch (err) { throw err; } }, (config: any) => !!config, retryCount, 2000, `Could not download remote config from ${endpointURL}`, cancellationTokenSource, ); }