diff options
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r-- | editors/code/src/ctx.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 9fcf2ec38..ff6245f78 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts | |||
@@ -91,15 +91,11 @@ export async function sendRequestWithRetry<R>( | |||
91 | for (const delay of [2, 4, 6, 8, 10, null]) { | 91 | for (const delay of [2, 4, 6, 8, 10, null]) { |
92 | try { | 92 | try { |
93 | return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param)); | 93 | return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param)); |
94 | } catch (e) { | 94 | } catch (err) { |
95 | if ( | 95 | if (delay === null || err.code !== lc.ErrorCodes.ContentModified) { |
96 | e.code === lc.ErrorCodes.ContentModified && | 96 | throw err; |
97 | delay !== null | ||
98 | ) { | ||
99 | await sleep(10 * (1 << delay)); | ||
100 | continue; | ||
101 | } | 97 | } |
102 | throw e; | 98 | await sleep(10 * (1 << delay)); |
103 | } | 99 | } |
104 | } | 100 | } |
105 | throw 'unreachable'; | 101 | throw 'unreachable'; |