(this: any, wrapped: Function, retryCount: number = 2)
| 45 | return configSettings.JupyterSettings.getInstance(resource, systemVariables.SystemVariables, 'node'); |
| 46 | } |
| 47 | export function retryAsync(this: any, wrapped: Function, retryCount: number = 2) { |
| 48 | return async (...args: any[]) => { |
| 49 | return new Promise((resolve, reject) => { |
| 50 | const reasons: any[] = []; |
| 51 | |
| 52 | const makeCall = () => { |
| 53 | wrapped.call(this as Function, ...args).then(resolve, (reason: any) => { |
| 54 | reasons.push(reason); |
| 55 | if (reasons.length >= retryCount) { |
| 56 | reject(reasons); |
| 57 | } else { |
| 58 | // If failed once, lets wait for some time before trying again. |
| 59 | setTimeout(makeCall, 500); |
| 60 | } |
| 61 | }); |
| 62 | }; |
| 63 | |
| 64 | makeCall(); |
| 65 | }); |
| 66 | }; |
| 67 | } |
| 68 | |
| 69 | async function setAutoSaveDelay(resource: string | Uri | undefined, config: ConfigurationTarget, delayinMS: number) { |
| 70 | if (config === vscode.ConfigurationTarget.WorkspaceFolder && !IS_MULTI_ROOT_TEST()) { |
no test coverage detected