@steve31415/baselib 3.20.0 → 3.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -127,7 +127,11 @@ export declare class SyncClient<B, C extends EventBody, S extends EventBody, Sum
|
|
|
127
127
|
private readonly abortControllers;
|
|
128
128
|
private readonly removeListeners;
|
|
129
129
|
private currentState;
|
|
130
|
+
/** Failed attempts in the current visible spell: drives the ladder and the
|
|
131
|
+
* outage log's `attempts` (what the user could have waited through). */
|
|
130
132
|
private reconnectAttempts;
|
|
133
|
+
/** Failed visible attempts across the whole outage (every spell). */
|
|
134
|
+
private totalAttempts;
|
|
131
135
|
private reconnectTimer;
|
|
132
136
|
private countdownTimer;
|
|
133
137
|
private pingTimer;
|
|
@@ -47,7 +47,11 @@ export class SyncClient {
|
|
|
47
47
|
abortControllers = new Set();
|
|
48
48
|
removeListeners = [];
|
|
49
49
|
currentState = { kind: 'starting', pending: 0 };
|
|
50
|
+
/** Failed attempts in the current visible spell: drives the ladder and the
|
|
51
|
+
* outage log's `attempts` (what the user could have waited through). */
|
|
50
52
|
reconnectAttempts = 0;
|
|
53
|
+
/** Failed visible attempts across the whole outage (every spell). */
|
|
54
|
+
totalAttempts = 0;
|
|
51
55
|
reconnectTimer = null;
|
|
52
56
|
countdownTimer = null;
|
|
53
57
|
pingTimer = null;
|
|
@@ -324,6 +328,10 @@ export class SyncClient {
|
|
|
324
328
|
this.rearmFailureTimers();
|
|
325
329
|
if (this.outageStartedAt !== null && !this.outageEscalated)
|
|
326
330
|
this.armEscalation();
|
|
331
|
+
// Each return starts the ladder afresh: failures from earlier glances
|
|
332
|
+
// (a phone shown for a second, often before its network is back) must
|
|
333
|
+
// not stretch this return's retry to 8-30 s or add up to a WARN.
|
|
334
|
+
this.reconnectAttempts = 0;
|
|
327
335
|
}
|
|
328
336
|
this.wakeConnection();
|
|
329
337
|
// Always: a socket that looks open may be dead (review S2), and a
|
|
@@ -678,6 +686,7 @@ export class SyncClient {
|
|
|
678
686
|
scheduleReconnect() {
|
|
679
687
|
const delay = RECONNECT_DELAYS_SECONDS[Math.min(this.reconnectAttempts, RECONNECT_DELAYS_SECONDS.length - 1)];
|
|
680
688
|
this.reconnectAttempts++;
|
|
689
|
+
this.totalAttempts++;
|
|
681
690
|
if (this.reconnectAttempts >= PROBE_AFTER_ATTEMPTS)
|
|
682
691
|
void this.probeSession();
|
|
683
692
|
let remaining = delay;
|
|
@@ -1060,13 +1069,15 @@ export class SyncClient {
|
|
|
1060
1069
|
if (this.outageStartedAt !== null) {
|
|
1061
1070
|
const durationMs = Math.max(0, this.options.runtime.now() - this.outageStartedAt);
|
|
1062
1071
|
// Failures are only counted (and the ladder only runs) while visible,
|
|
1063
|
-
// so `attempts` is what the
|
|
1072
|
+
// and the count restarts on each return, so `attempts` is what the
|
|
1073
|
+
// user could have waited through; `totalAttempts` spans every spell.
|
|
1064
1074
|
const attempts = this.reconnectAttempts;
|
|
1065
1075
|
const info = this.outageInfo;
|
|
1066
1076
|
const delta = info ? SyncClient.delta(info.counters, this.snapshot()) : null;
|
|
1067
1077
|
const fields = {
|
|
1068
1078
|
durationMs,
|
|
1069
1079
|
attempts,
|
|
1080
|
+
totalAttempts: this.totalAttempts,
|
|
1070
1081
|
closeCode: info?.closeCode,
|
|
1071
1082
|
wasClean: info?.wasClean,
|
|
1072
1083
|
visibleAtDrop: info?.visibleAtDrop,
|
|
@@ -1100,6 +1111,7 @@ export class SyncClient {
|
|
|
1100
1111
|
this.options.runtime.clearTimeout(this.escalateTimer);
|
|
1101
1112
|
this.escalateTimer = null;
|
|
1102
1113
|
this.reconnectAttempts = 0;
|
|
1114
|
+
this.totalAttempts = 0;
|
|
1103
1115
|
for (const [eventGuid, entry] of this.pending) {
|
|
1104
1116
|
if (this.settledPending.has(eventGuid)) {
|
|
1105
1117
|
this.retrySettlement(eventGuid);
|
package/package.json
CHANGED