Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

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

liuyi405167854bbf
diff --git a/packages/backend/server/src/modules/doc/manager.ts b/packages/backend/server/src/modules/doc/manager.ts
index 34ec7e5af0..e5b0a2fe05 100644
--- a/packages/backend/server/src/modules/doc/manager.ts
+++ b/packages/backend/server/src/modules/doc/manager.ts
@@ -201,6 +201,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
defer(async () => {
const seq = await this.getUpdateSeq(workspaceId, guid);
await this.db.update.create({
+ select: {
+ seq: true,
+ },
data: {
workspaceId,
id: guid,
@@ -388,10 +391,13 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
const state = Buffer.from(encodeStateVector(doc));
if (isEmptyBuffer(blob)) {
- return null;
+ return;
}
- return this.db.snapshot.upsert({
+ await this.db.snapshot.upsert({
+ select: {
+ seq: true,
+ },
where: {
id_workspaceId: {
id: guid,