Skip to content

Commit

Permalink
fix: weekly trending tags (#870)
Browse files Browse the repository at this point in the history
fix weekly trending topic
  • Loading branch information
RiXelanya committed Jun 1, 2023
1 parent a2017a1 commit f92dbdb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/jobs/update-trending-topic.job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ export class UpdateTrendingTopicJob extends CronJob {
onTick: () => {
this.performJob().finally(console.log);
},
cronTime: '0 */30 * * * *',
// cronTime: '0 */30 * * * *',
cronTime: '0 0 0 * * 0', // every sunday 12 am
start: true,
});
}

async performJob() {
const oneDay = 24 * 60 * 60 * 1000;
// const oneDay = 24 * 60 * 60 * 1000;
const oneWeek = 7 * 24 * 60 * 60 * 1000;

await this.tagRepository.updateAll(
{count: 1},
{updatedAt: {lt: new Date(Date.now() - oneDay).toString()}},
// {updatedAt: {lt: new Date(Date.now() - oneDay).toString()}},
{updatedAt: {lt: new Date(Date.now() - oneWeek).toString()}},
);
}
}

0 comments on commit f92dbdb

Please sign in to comment.