perf(server): avoid auto select blob data when upsert (#4891)

This commit is contained in:
liuyi
2023-11-09 18:45:31 +08:00
committed by GitHub
parent f9654bb1f8
commit 405167854b

View File

@@ -201,6 +201,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
defer(async () => { defer(async () => {
const seq = await this.getUpdateSeq(workspaceId, guid); const seq = await this.getUpdateSeq(workspaceId, guid);
await this.db.update.create({ await this.db.update.create({
select: {
seq: true,
},
data: { data: {
workspaceId, workspaceId,
id: guid, id: guid,
@@ -388,10 +391,13 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
const state = Buffer.from(encodeStateVector(doc)); const state = Buffer.from(encodeStateVector(doc));
if (isEmptyBuffer(blob)) { if (isEmptyBuffer(blob)) {
return null; return;
} }
return this.db.snapshot.upsert({ await this.db.snapshot.upsert({
select: {
seq: true,
},
where: { where: {
id_workspaceId: { id_workspaceId: {
id: guid, id: guid,