@effectstream/runtime 0.100.25 → 0.100.26
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 +12 -12
- package/src/coalesce.ts +9 -2
- package/src/main.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/runtime",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": "./src/mod.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@effectstream/concise": "0.100.
|
|
17
|
-
"@effectstream/config": "0.100.
|
|
18
|
-
"@effectstream/coroutine": "0.100.
|
|
19
|
-
"@effectstream/crypto": "0.100.
|
|
20
|
-
"@effectstream/db": "0.100.
|
|
21
|
-
"@effectstream/event-client": "0.100.
|
|
22
|
-
"@effectstream/event-server": "0.100.
|
|
23
|
-
"@effectstream/log": "0.100.
|
|
24
|
-
"@effectstream/sm": "0.100.
|
|
25
|
-
"@effectstream/sync": "0.100.
|
|
26
|
-
"@effectstream/utils": "0.100.
|
|
16
|
+
"@effectstream/concise": "0.100.26",
|
|
17
|
+
"@effectstream/config": "0.100.26",
|
|
18
|
+
"@effectstream/coroutine": "0.100.26",
|
|
19
|
+
"@effectstream/crypto": "0.100.26",
|
|
20
|
+
"@effectstream/db": "0.100.26",
|
|
21
|
+
"@effectstream/event-client": "0.100.26",
|
|
22
|
+
"@effectstream/event-server": "0.100.26",
|
|
23
|
+
"@effectstream/log": "0.100.26",
|
|
24
|
+
"@effectstream/sm": "0.100.26",
|
|
25
|
+
"@effectstream/sync": "0.100.26",
|
|
26
|
+
"@effectstream/utils": "0.100.26",
|
|
27
27
|
"@fastify/cors": "^11.0.1",
|
|
28
28
|
"@metamask/json-rpc-engine": "^10.0.3",
|
|
29
29
|
"pg": "8.21.0",
|
package/src/coalesce.ts
CHANGED
|
@@ -34,11 +34,18 @@ const MAX_RETRY_BACKOFF_MS = 5_000;
|
|
|
34
34
|
|
|
35
35
|
export function* loadEmptyRunBoundaries(
|
|
36
36
|
dbConn: Pool,
|
|
37
|
+
fromBlockNumber: number,
|
|
37
38
|
): Operation<EmptyRunBoundaries> {
|
|
38
39
|
const [bh] = yield* until(getEarliestScheduledBlockHeight.run(undefined, dbConn));
|
|
39
40
|
const [ts] = yield* until(getEarliestScheduledTimestamp.run(undefined, dbConn));
|
|
41
|
+
// Ignore scheduled block heights already in the past: a stale unprocessed row
|
|
42
|
+
// (e.g. from a DB reset) would otherwise permanently suppress coalescing for
|
|
43
|
+
// all current blocks, since every block number >= the stale height.
|
|
44
|
+
const minScheduledBlockHeight = bh?.min_block_height != null && bh.min_block_height >= fromBlockNumber
|
|
45
|
+
? bh.min_block_height
|
|
46
|
+
: null;
|
|
40
47
|
return {
|
|
41
|
-
minScheduledBlockHeight
|
|
48
|
+
minScheduledBlockHeight,
|
|
42
49
|
minScheduledTimestampMs: ts?.min_timestamp != null
|
|
43
50
|
? new Date(ts.min_timestamp).getTime()
|
|
44
51
|
: null,
|
|
@@ -274,7 +281,7 @@ export function createEmptyBlockCoalescer(
|
|
|
274
281
|
Date.now() - value.timestamp > opts.lagThresholdMs;
|
|
275
282
|
if (behindTip && value.primitives.length === 0) {
|
|
276
283
|
const boundaries = pendingRun?.boundaries ??
|
|
277
|
-
(yield* loadEmptyRunBoundaries(opts.pool));
|
|
284
|
+
(yield* loadEmptyRunBoundaries(opts.pool, value.blockNumber));
|
|
278
285
|
if (isCoalescableEmptyBlock(value, boundaries, opts.migrations)) {
|
|
279
286
|
pendingRun = pendingRun
|
|
280
287
|
? { boundaries, endpoint: value, length: pendingRun.length + 1 }
|
package/src/main.ts
CHANGED
|
@@ -96,12 +96,14 @@ export function* start(config: StartConfig): Operation<void> {
|
|
|
96
96
|
);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
// 10× main clock block time (NTP if present, else protocol 0).
|
|
99
|
+
// 10× main clock block time (NTP if present, else protocol 0).
|
|
100
|
+
// Falls back to 60 s so coalescing is not silently disabled for chains that
|
|
101
|
+
// don't expose a blockTimeMS on their network config (e.g. Midnight-as-main).
|
|
100
102
|
const ntpConfig = syncInfo.find(s => s.networkType === ConfigNetworkType.NTP);
|
|
101
103
|
const clockBlockTimeMS =
|
|
102
104
|
(ntpConfig?.network as { blockTimeMS?: number } | undefined)?.blockTimeMS ??
|
|
103
105
|
(syncInfo[0]?.network as { blockTimeMS?: number } | undefined)?.blockTimeMS;
|
|
104
|
-
const lagThresholdMs = clockBlockTimeMS != null ? clockBlockTimeMS * 10 :
|
|
106
|
+
const lagThresholdMs = clockBlockTimeMS != null ? clockBlockTimeMS * 10 : 60_000;
|
|
105
107
|
|
|
106
108
|
// Bounded hand-off queue between the merge and the apply loop. Backpressure caps
|
|
107
109
|
// the in-memory queue so deep catch-up can't grow it toward the whole backlog
|