fix: batch to schedule

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2023-04-25 21:36:38 +08:00
parent 44286f2bff
commit ccd570dac3
3 changed files with 4 additions and 4 deletions

View File

@@ -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)) {

View File

@@ -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,
})

View File

@@ -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 })