MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / retryAsync

Function retryAsync

src/test/common.node.ts:47–67  ·  view source on GitHub ↗
(this: any, wrapped: Function, retryCount: number = 2)

Source from the content-addressed store, hash-verified

45 return configSettings.JupyterSettings.getInstance(resource, systemVariables.SystemVariables, 'node');
46}
47export 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
69async function setAutoSaveDelay(resource: string | Uri | undefined, config: ConfigurationTarget, delayinMS: number) {
70 if (config === vscode.ConfigurationTarget.WorkspaceFolder && !IS_MULTI_ROOT_TEST()) {

Callers 2

Calls 1

makeCallFunction · 0.85

Tested by

no test coverage detected