This commit is contained in:
ditiqi 2025-02-24 09:32:59 +08:00
parent 0081ccf3f2
commit ab1bce816b
1 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {
updateCourseReviewStats,
updateParentLectureStats,
} from '@server/models/post/utils';
import { updatePostViewCount } from '../models/post/utils';
const logger = new Logger('QueueWorker');
export default async function processJob(job: Job<any, any, QueueJobType>) {
try {
@ -44,6 +45,12 @@ export default async function processJob(job: Job<any, any, QueueJobType>) {
`Updated course stats for courseId: ${courseId}, type: ${type}`,
);
}
if (job.name === QueueJobType.UPDATE_POST_VISIT_COUNT) {
await updatePostViewCount(job.data.id, job.data.type);
}
if (job.name === QueueJobType.UPDATE_POST_STATE) {
await updatePostViewCount(job.data.id, job.data.type);
}
} catch (error: any) {
logger.error(
`Error processing stats update job: ${error.message}`,