mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix(server): use last update creating time as snasphot update timestamp (#5266)
This commit is contained in:
@@ -464,6 +464,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
|
|||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
guid: string,
|
guid: string,
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
|
// we always delay the snapshot update to avoid db overload,
|
||||||
|
// so the value of `updatedAt` will not be accurate to user's real action time
|
||||||
|
updatedAt: Date,
|
||||||
initialSeq?: number
|
initialSeq?: number
|
||||||
) {
|
) {
|
||||||
return this.lockSnapshotForUpsert(workspaceId, guid, async () => {
|
return this.lockSnapshotForUpsert(workspaceId, guid, async () => {
|
||||||
@@ -502,6 +505,7 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
|
|||||||
data: {
|
data: {
|
||||||
blob,
|
blob,
|
||||||
state,
|
state,
|
||||||
|
updatedAt,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -521,6 +525,8 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
|
|||||||
blob,
|
blob,
|
||||||
state,
|
state,
|
||||||
seq: initialSeq,
|
seq: initialSeq,
|
||||||
|
createdAt: updatedAt,
|
||||||
|
updatedAt,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -565,7 +571,13 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
|
|||||||
...updates.map(u => u.blob)
|
...updates.map(u => u.blob)
|
||||||
);
|
);
|
||||||
|
|
||||||
const done = await this.upsert(workspaceId, id, doc, last.seq);
|
const done = await this.upsert(
|
||||||
|
workspaceId,
|
||||||
|
id,
|
||||||
|
doc,
|
||||||
|
last.createdAt,
|
||||||
|
last.seq
|
||||||
|
);
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
if (snapshot) {
|
if (snapshot) {
|
||||||
|
|||||||
Reference in New Issue
Block a user