From ccd570dac3a35625a2b54b4b7b8d8b83c944d179 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 25 Apr 2023 21:36:38 +0800 Subject: [PATCH] fix: batch to schedule Signed-off-by: Innei --- src/modules/comment/comment.controller.ts | 4 ++-- src/modules/note/note.service.ts | 2 +- src/modules/post/post.service.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/comment/comment.controller.ts b/src/modules/comment/comment.controller.ts index df3f35e7..10b5400c 100644 --- a/src/modules/comment/comment.controller.ts +++ b/src/modules/comment/comment.controller.ts @@ -197,14 +197,14 @@ export class CommentController { const comment = await this.commentService.createComment(id, model, ref) const commentId = comment._id.toString() - scheduleManager.batch(async () => { + scheduleManager.schedule(async () => { if (isMaster) { return } await this.commentService.appendIpLocation(commentId, ipLocation.ip) }) - scheduleManager.batch(async () => { + scheduleManager.schedule(async () => { const configs = await this.configsService.get('commentOptions') const { commentShouldAudit } = configs if (await this.commentService.checkSpam(comment)) { diff --git a/src/modules/note/note.service.ts b/src/modules/note/note.service.ts index 524beedd..d46787c4 100644 --- a/src/modules/note/note.service.ts +++ b/src/modules/note/note.service.ts @@ -185,7 +185,7 @@ export class NoteService { throw new NoContentCanBeModifiedException() } - scheduleManager.batch(async () => { + scheduleManager.schedule(async () => { this.eventManager.emit(EventBusEvents.CleanAggregateCache, null, { scope: EventScope.TO_SYSTEM, }) diff --git a/src/modules/post/post.service.ts b/src/modules/post/post.service.ts index e87fe122..c72ae396 100644 --- a/src/modules/post/post.service.ts +++ b/src/modules/post/post.service.ts @@ -160,7 +160,7 @@ export class PostService { ) await oldDocument.save() - scheduleManager.batch(async () => { + scheduleManager.schedule(async () => { const doc = await this.postModel .findById(id) .lean({ getters: true, autopopulate: true })