@ccmsg/protocol 2.0.0 → 2.0.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.
- package/package.json +1 -1
- package/src/control/peers.ts +13 -6
package/package.json
CHANGED
package/src/control/peers.ts
CHANGED
|
@@ -40,8 +40,9 @@ export type SessionRun = Static<typeof SessionRun>;
|
|
|
40
40
|
* whether anything it says can still be trusted. */
|
|
41
41
|
export const SessionStatusStanding = Type.Union(
|
|
42
42
|
[
|
|
43
|
-
/**
|
|
44
|
-
* started stands here until the harness writes its first record
|
|
43
|
+
/** Nothing is folded: there is no transcript yet (a session that has just
|
|
44
|
+
* started stands here until the harness writes its first record), or this
|
|
45
|
+
* instance holds no fold of it because nothing has asked for one. */
|
|
45
46
|
Type.Literal("absent"),
|
|
46
47
|
/** The transcript is being read from the top; what the fold says so far is
|
|
47
48
|
* incomplete. */
|
|
@@ -236,10 +237,16 @@ export function liveness(
|
|
|
236
237
|
now: number,
|
|
237
238
|
): Liveness {
|
|
238
239
|
if (row.runs.length >= 2) return "duplicated";
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
if (row.runs.length === 1) return "alive";
|
|
241
|
+
// No run is seen, so the declaration and the gateway are all there is to go
|
|
242
|
+
// on: inference still running for it is a session that is alive somewhere
|
|
243
|
+
// this instance cannot see the process of.
|
|
244
|
+
if (
|
|
245
|
+
row.gateway_active_at !== undefined &&
|
|
246
|
+
now - row.gateway_active_at <= GATEWAY_LIVE_WINDOW_MS
|
|
247
|
+
) {
|
|
248
|
+
return "alive";
|
|
249
|
+
}
|
|
243
250
|
return row.stopped_at === undefined ? "disappeared" : "paused";
|
|
244
251
|
}
|
|
245
252
|
|