ahmed-rivet-convex 2.2.8 → 2.2.10
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/dist/{chunk-H4HI57GK.js → chunk-EUAHV7B3.js} +53 -10
- package/dist/react.js +1 -1
- package/dist/zero.js +1 -1
- package/package.json +1 -1
|
@@ -661,6 +661,7 @@ var PushDelegate = class extends ConnectionLoopDelegateImpl {
|
|
|
661
661
|
import { resolver as resolver3 } from "@rocicorp/resolver";
|
|
662
662
|
var MIN_DELAY_MS = 30;
|
|
663
663
|
var MAX_DELAY_MS = 6e4;
|
|
664
|
+
var monotonicNow = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
664
665
|
var ConnectionLoop = class {
|
|
665
666
|
// ConnectionLoop runs a loop sending network requests (either pushes or
|
|
666
667
|
// pulls) to the server. Our goal, generally, is to send requests as fast as
|
|
@@ -797,7 +798,7 @@ var ConnectionLoop = class {
|
|
|
797
798
|
Math.max(delegate.minDelayMs, delay)
|
|
798
799
|
);
|
|
799
800
|
if (lastSendTime !== void 0) {
|
|
800
|
-
const timeSinceLastSend =
|
|
801
|
+
const timeSinceLastSend = monotonicNow() - lastSendTime;
|
|
801
802
|
if (clampedDelay > timeSinceLastSend) {
|
|
802
803
|
await Promise.race([
|
|
803
804
|
sleepMaybeSkip(clampedDelay - timeSinceLastSend),
|
|
@@ -808,7 +809,7 @@ var ConnectionLoop = class {
|
|
|
808
809
|
}
|
|
809
810
|
counter++;
|
|
810
811
|
void (async () => {
|
|
811
|
-
const start =
|
|
812
|
+
const start = monotonicNow();
|
|
812
813
|
let ok;
|
|
813
814
|
let error;
|
|
814
815
|
try {
|
|
@@ -826,8 +827,9 @@ var ConnectionLoop = class {
|
|
|
826
827
|
debug?.("Closed after invokeSend");
|
|
827
828
|
return;
|
|
828
829
|
}
|
|
829
|
-
|
|
830
|
-
|
|
830
|
+
const duration = monotonicNow() - start;
|
|
831
|
+
debug?.("Request done", { duration, ok });
|
|
832
|
+
sendRecords.push({ duration, ok });
|
|
831
833
|
if (recovered(sendRecords)) {
|
|
832
834
|
recoverResolver.resolve();
|
|
833
835
|
recoverResolver = resolver3();
|
|
@@ -4679,6 +4681,32 @@ async function persistDD31(lc, clientID, memdag, perdag, mutators, closed, forma
|
|
|
4679
4681
|
);
|
|
4680
4682
|
}
|
|
4681
4683
|
}
|
|
4684
|
+
if (!memdagBaseSnapshotPersisted) {
|
|
4685
|
+
const latestBase = await baseSnapshotFromCommit(
|
|
4686
|
+
latestPerdagMainClientGroupHeadCommit,
|
|
4687
|
+
perdagWrite
|
|
4688
|
+
);
|
|
4689
|
+
assertSnapshotCommitDD31(latestBase);
|
|
4690
|
+
if (compareCookiesForSnapshots(memdagBaseSnapshot, latestBase) <= 0 && (memdagBaseSnapshot.meta.lastMutationIDs[clientID] ?? 0) > await latestPerdagMainClientGroupHeadCommit.getMutationID(
|
|
4691
|
+
clientID,
|
|
4692
|
+
perdagWrite
|
|
4693
|
+
)) {
|
|
4694
|
+
lc.debug?.(
|
|
4695
|
+
"persist deferred: perdag head trails this client's confirmed LMID",
|
|
4696
|
+
{
|
|
4697
|
+
clientID,
|
|
4698
|
+
memdagLMID: memdagBaseSnapshot.meta.lastMutationIDs[clientID],
|
|
4699
|
+
perdagHeadLMID: await latestPerdagMainClientGroupHeadCommit.getMutationID(
|
|
4700
|
+
clientID,
|
|
4701
|
+
perdagWrite
|
|
4702
|
+
),
|
|
4703
|
+
memdagCookie: memdagBaseSnapshot.meta.cookieJSON,
|
|
4704
|
+
perdagCookie: latestBase.meta.cookieJSON
|
|
4705
|
+
}
|
|
4706
|
+
);
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4682
4710
|
let zeroDataForPerdagHeadCommit;
|
|
4683
4711
|
if (!memdagBaseSnapshotPersisted && getZeroData) {
|
|
4684
4712
|
if (newMainClientGroupHeadHash !== perdagHeadHashAtRead) {
|
|
@@ -4823,7 +4851,9 @@ async function refresh(lc, memdag, perdag, clientID, mutators, diffConfig, close
|
|
|
4823
4851
|
if (shouldAbortRefresh(
|
|
4824
4852
|
memdagBaseSnapshot,
|
|
4825
4853
|
perdagClientGroupBaseSnapshot2,
|
|
4826
|
-
perdagClientGroupHeadHash2
|
|
4854
|
+
perdagClientGroupHeadHash2,
|
|
4855
|
+
perdagLmid2,
|
|
4856
|
+
clientID
|
|
4827
4857
|
)) {
|
|
4828
4858
|
return void 0;
|
|
4829
4859
|
}
|
|
@@ -4881,7 +4911,9 @@ async function refresh(lc, memdag, perdag, clientID, mutators, diffConfig, close
|
|
|
4881
4911
|
if (shouldAbortRefresh(
|
|
4882
4912
|
memdagBaseSnapshot2,
|
|
4883
4913
|
perdagClientGroupBaseSnapshot,
|
|
4884
|
-
perdagClientGroupHeadHash
|
|
4914
|
+
perdagClientGroupHeadHash,
|
|
4915
|
+
perdagLmid,
|
|
4916
|
+
clientID
|
|
4885
4917
|
)) {
|
|
4886
4918
|
return {
|
|
4887
4919
|
type: "aborted",
|
|
@@ -4962,12 +4994,12 @@ async function refresh(lc, memdag, perdag, clientID, mutators, diffConfig, close
|
|
|
4962
4994
|
diffs: result.diffs
|
|
4963
4995
|
};
|
|
4964
4996
|
}
|
|
4965
|
-
function shouldAbortRefresh(memdagBaseSnapshot, perdagClientGroupBaseSnapshot, perdagClientGroupHeadHash) {
|
|
4997
|
+
function shouldAbortRefresh(memdagBaseSnapshot, perdagClientGroupBaseSnapshot, perdagClientGroupHeadHash, perdagLmid, clientID) {
|
|
4966
4998
|
const baseSnapshotCookieCompareResult = compareCookiesForSnapshots(
|
|
4967
4999
|
memdagBaseSnapshot,
|
|
4968
5000
|
perdagClientGroupBaseSnapshot
|
|
4969
5001
|
);
|
|
4970
|
-
return baseSnapshotCookieCompareResult > 0 || baseSnapshotCookieCompareResult === 0 && perdagClientGroupHeadHash === perdagClientGroupBaseSnapshot.chunk.hash;
|
|
5002
|
+
return baseSnapshotCookieCompareResult > 0 || (memdagBaseSnapshot.meta.lastMutationIDs[clientID] ?? 0) > perdagLmid || baseSnapshotCookieCompareResult === 0 && perdagClientGroupHeadHash === perdagClientGroupBaseSnapshot.chunk.hash;
|
|
4971
5003
|
}
|
|
4972
5004
|
|
|
4973
5005
|
// ../replicache/src/process-scheduler.ts
|
|
@@ -6058,6 +6090,7 @@ var ReplicacheImpl = class {
|
|
|
6058
6090
|
resolve();
|
|
6059
6091
|
}
|
|
6060
6092
|
async maybeEndPull(syncHead, requestID) {
|
|
6093
|
+
let chunkRetries = 0;
|
|
6061
6094
|
for (; ; ) {
|
|
6062
6095
|
if (this.#closed) {
|
|
6063
6096
|
return;
|
|
@@ -6079,7 +6112,17 @@ var ReplicacheImpl = class {
|
|
|
6079
6112
|
void this.#schedulePersist();
|
|
6080
6113
|
return;
|
|
6081
6114
|
}
|
|
6082
|
-
|
|
6115
|
+
let zeroData2;
|
|
6116
|
+
try {
|
|
6117
|
+
zeroData2 = await this.#zero?.getTxData?.(syncHead);
|
|
6118
|
+
} catch (e) {
|
|
6119
|
+
if (e instanceof ChunkNotFoundError && ++chunkRetries <= 3) {
|
|
6120
|
+
lc.debug?.("IVM base moved during replay; retrying", e.message);
|
|
6121
|
+
await Promise.resolve();
|
|
6122
|
+
continue;
|
|
6123
|
+
}
|
|
6124
|
+
throw e;
|
|
6125
|
+
}
|
|
6083
6126
|
for (const mutation of replayMutations) {
|
|
6084
6127
|
if (this.#subscriptions.hasPendingSubscriptionRuns) {
|
|
6085
6128
|
await Promise.resolve();
|
|
@@ -15611,7 +15654,7 @@ function makeMessage(message, context, logLevel) {
|
|
|
15611
15654
|
}
|
|
15612
15655
|
|
|
15613
15656
|
// ../zero-client/src/client/version.ts
|
|
15614
|
-
var version2 = "2.2.
|
|
15657
|
+
var version2 = "2.2.10";
|
|
15615
15658
|
|
|
15616
15659
|
// ../zero-client/src/client/log-options.ts
|
|
15617
15660
|
var LevelFilterLogSink = class {
|
package/dist/react.js
CHANGED
package/dist/zero.js
CHANGED
package/package.json
CHANGED