Backoff live subscription retries after a failed connect

This commit is contained in:
2026-09-20 19:10:43 -04:00
parent 54f5708142
commit ff1055fff4
3 changed files with 408 additions and 352 deletions
File diff suppressed because it is too large Load Diff
+20 -1
View File
@@ -732,6 +732,7 @@ export class NestQuestPartyBoardCard extends LitElement {
private _unsubs: Array<() => void> = [];
private _subscribed = false;
private _subGeneration = 0;
private _retryTimer?: number;
setConfig(config: CardConfig): void {
if (!config || typeof config !== "object") {
@@ -775,7 +776,7 @@ export class NestQuestPartyBoardCard extends LitElement {
.catch(() => {
if (token === this._subGeneration) {
this._unsubscribeLive();
this.requestUpdate();
this._armSubscribeRetry();
}
});
};
@@ -786,7 +787,25 @@ export class NestQuestPartyBoardCard extends LitElement {
}
}
private _armSubscribeRetry(): void {
if (this._retryTimer !== undefined) {
return;
}
this._retryTimer = window.setTimeout(() => {
this._retryTimer = undefined;
this._subscribeLive();
}, 1000);
}
private _clearSubscribeRetry(): void {
if (this._retryTimer !== undefined) {
window.clearTimeout(this._retryTimer);
this._retryTimer = undefined;
}
}
private _unsubscribeLive(): void {
this._clearSubscribeRetry();
this._subGeneration++;
for (const unsub of this._unsubs) {
unsub();
+20 -1
View File
@@ -1378,6 +1378,7 @@ export class NestQuestQuestLogCard extends LitElement {
private _unsubs: Array<() => void> = [];
private _subscribed = false;
private _subGeneration = 0;
private _retryTimer?: number;
setConfig(config: QuestLogCardConfig): void {
if (!config || typeof config !== "object") {
@@ -1421,7 +1422,7 @@ export class NestQuestQuestLogCard extends LitElement {
.catch(() => {
if (token === this._subGeneration) {
this._unsubscribeLive();
this.requestUpdate();
this._armSubscribeRetry();
}
});
};
@@ -1432,7 +1433,25 @@ export class NestQuestQuestLogCard extends LitElement {
}
}
private _armSubscribeRetry(): void {
if (this._retryTimer !== undefined) {
return;
}
this._retryTimer = window.setTimeout(() => {
this._retryTimer = undefined;
this._subscribeLive();
}, 1000);
}
private _clearSubscribeRetry(): void {
if (this._retryTimer !== undefined) {
window.clearTimeout(this._retryTimer);
this._retryTimer = undefined;
}
}
private _unsubscribeLive(): void {
this._clearSubscribeRetry();
this._subGeneration++;
for (const unsub of this._unsubs) {
unsub();