feat: sync trending
This commit is contained in:
parent
d91aa3edf9
commit
27183220a4
|
|
@ -6,6 +6,7 @@ import { DatabaseModule } from '@gitroom/nestjs-libraries/database/prisma/databa
|
|||
import { RedisModule } from '@gitroom/nestjs-libraries/redis/redis.module';
|
||||
import { BullMqModule } from '@gitroom/nestjs-libraries/bull-mq-transport/bull-mq.module';
|
||||
import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
|
||||
import { SyncTrending } from '@gitroom/cron/tasks/sync.trending';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
@ -17,6 +18,6 @@ import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
|
|||
}),
|
||||
],
|
||||
controllers: [],
|
||||
providers: [RefreshTokens, CheckStars],
|
||||
providers: [RefreshTokens, CheckStars, SyncTrending],
|
||||
})
|
||||
export class CronModule {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { Cron } from '@nestjs/schedule';
|
||||
import { BullMqClient } from '@gitroom/nestjs-libraries/bull-mq-transport/client/bull-mq.client';
|
||||
|
||||
@Injectable()
|
||||
export class SyncTrending {
|
||||
constructor(
|
||||
private _workerServiceProducer: BullMqClient
|
||||
) {}
|
||||
@Cron('0 * * * *')
|
||||
async syncTrending() {
|
||||
this._workerServiceProducer.emit('sync_trending', {}).subscribe();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue