mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
vscode: minor refactorings
This commit is contained in:
parent
31ae646448
commit
bd113623a0
3 changed files with 28 additions and 30 deletions
|
@ -91,15 +91,11 @@ export async function sendRequestWithRetry<R>(
|
|||
for (const delay of [2, 4, 6, 8, 10, null]) {
|
||||
try {
|
||||
return await (token ? client.sendRequest(method, param, token) : client.sendRequest(method, param));
|
||||
} catch (e) {
|
||||
if (
|
||||
e.code === lc.ErrorCodes.ContentModified &&
|
||||
delay !== null
|
||||
) {
|
||||
await sleep(10 * (1 << delay));
|
||||
continue;
|
||||
} catch (err) {
|
||||
if (delay === null || err.code !== lc.ErrorCodes.ContentModified) {
|
||||
throw err;
|
||||
}
|
||||
throw e;
|
||||
await sleep(10 * (1 << delay));
|
||||
}
|
||||
}
|
||||
throw 'unreachable';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue