Skip to content

Commit a0dac60

Browse files
Merge pull request intersystems-community#1197 from gjsjohnmurray/fix-1196
Always delete cached authentication promise when request fails (fix intersystems-community#1196)
2 parents 0916d94 + ff8766c commit a0dac60

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,19 @@ export class AtelierAPI {
435435

436436
return data;
437437
} catch (error) {
438-
if (error.code === "ECONNREFUSED") {
439-
authRequestMap.delete(target);
438+
// always discard the cached authentication promise
439+
authRequestMap.delete(target);
440+
441+
// In some cases schedule an automatic retry.
442+
// ENOTFOUND occurs if, say, the VPN to the server's network goes down.
443+
if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND") {
440444
panel.text = `${this.connInfo} $(debug-disconnect)`;
441445
panel.tooltip = "Disconnected";
442446
workspaceState.update(this.configName.toLowerCase() + ":host", undefined);
443447
workspaceState.update(this.configName.toLowerCase() + ":port", undefined);
444448
if (!checkingConnection) {
445449
setTimeout(() => checkConnection(false, undefined, true), 30000);
446450
}
447-
} else if (error.code === "EPROTO") {
448-
// This can happen if https was configured but didn't work
449-
authRequestMap.delete(target);
450451
}
451452
throw error;
452453
}

0 commit comments

Comments
 (0)