fix(nbstore): fix doc sync logic (#10400)
This commit is contained in:
@@ -680,6 +680,7 @@ export class DocSyncPeer {
|
|||||||
const cachedClocks = await this.syncMetadata.getPeerRemoteClocks(
|
const cachedClocks = await this.syncMetadata.getPeerRemoteClocks(
|
||||||
this.peerId
|
this.peerId
|
||||||
);
|
);
|
||||||
|
this.status.remoteClocks.clear();
|
||||||
throwIfAborted(signal);
|
throwIfAborted(signal);
|
||||||
for (const [id, v] of Object.entries(cachedClocks)) {
|
for (const [id, v] of Object.entries(cachedClocks)) {
|
||||||
this.status.remoteClocks.set(id, v);
|
this.status.remoteClocks.set(id, v);
|
||||||
@@ -690,8 +691,9 @@ export class DocSyncPeer {
|
|||||||
const maxClockValue = this.status.remoteClocks.max;
|
const maxClockValue = this.status.remoteClocks.max;
|
||||||
const newClocks = await this.remote.getDocTimestamps(maxClockValue);
|
const newClocks = await this.remote.getDocTimestamps(maxClockValue);
|
||||||
for (const [id, v] of Object.entries(newClocks)) {
|
for (const [id, v] of Object.entries(newClocks)) {
|
||||||
this.actions.updateRemoteClock(id, v);
|
this.status.remoteClocks.set(id, v);
|
||||||
}
|
}
|
||||||
|
this.statusUpdatedSubject$.next(true);
|
||||||
|
|
||||||
for (const [id, v] of Object.entries(newClocks)) {
|
for (const [id, v] of Object.entries(newClocks)) {
|
||||||
await this.syncMetadata.setPeerRemoteClock(this.peerId, {
|
await this.syncMetadata.setPeerRemoteClock(this.peerId, {
|
||||||
|
|||||||
Reference in New Issue
Block a user