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

This commit is contained in:
liuyi
2023-11-07 17:18:02 +08:00
committed by GitHub
parent 01d7fe4597
commit b99ac51624

View File

@@ -78,7 +78,7 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
protected recoverDoc(...updates: Buffer[]): Promise<Doc> { protected recoverDoc(...updates: Buffer[]): Promise<Doc> {
const doc = new Doc(); const doc = new Doc();
const chunks = chunk(updates, 100); const chunks = chunk(updates, 10);
return new Promise(resolve => { return new Promise(resolve => {
const next = () => { const next = () => {
@@ -355,8 +355,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
protected async autoSquash() { protected async autoSquash() {
// find the first update and batch process updates with same id // find the first update and batch process updates with same id
const first = await this.db.update.findFirst({ const first = await this.db.update.findFirst({
orderBy: { select: {
createdAt: 'asc', id: true,
workspaceId: true,
}, },
}); });