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.

chore(server): decrease amount of batch updates merging (#4860)

liuyib99ac51624b4
diff --git a/packages/backend/server/src/modules/doc/manager.ts b/packages/backend/server/src/modules/doc/manager.ts
index 7f8de7b9f6..34ec7e5af0 100644
--- a/packages/backend/server/src/modules/doc/manager.ts
+++ b/packages/backend/server/src/modules/doc/manager.ts
@@ -78,7 +78,7 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
protected recoverDoc(...updates: Buffer[]): Promise<Doc> {
const doc = new Doc();
- const chunks = chunk(updates, 100);
+ const chunks = chunk(updates, 10);
return new Promise(resolve => {
const next = () => {
@@ -355,8 +355,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
protected async autoSquash() {
// find the first update and batch process updates with same id
const first = await this.db.update.findFirst({
- orderBy: {
- createdAt: 'asc',
+ select: {
+ id: true,
+ workspaceId: true,
},
});