fix(nbstore): fix doc clock check logic (#10355)

This commit is contained in:
EYHN
2025-02-21 19:10:16 +08:00
committed by GitHub
parent 7d68aa5b2f
commit 4a66ec7400

View File

@@ -247,7 +247,7 @@ export class DocSyncPeer {
!this.remote.isReadonly && !this.remote.isReadonly &&
clock && clock &&
(pushedClock === null || (pushedClock === null ||
pushedClock.getTime() !== clock.timestamp.getTime()) pushedClock.getTime() < clock.timestamp.getTime())
) { ) {
await this.jobs.pullAndPush(docId, signal); await this.jobs.pullAndPush(docId, signal);
} else { } else {
@@ -255,9 +255,10 @@ export class DocSyncPeer {
const pulled = const pulled =
(await this.syncMetadata.getPeerPulledRemoteClock(this.peerId, docId)) (await this.syncMetadata.getPeerPulledRemoteClock(this.peerId, docId))
?.timestamp ?? null; ?.timestamp ?? null;
const remoteClock = this.status.remoteClocks.get(docId);
if ( if (
pulled === null || remoteClock &&
pulled.getTime() !== this.status.remoteClocks.get(docId)?.getTime() (pulled === null || pulled.getTime() < remoteClock.getTime())
) { ) {
await this.jobs.pull(docId, signal); await this.jobs.pull(docId, signal);
} }