feat: missing payload
This commit is contained in:
parent
ae7dfa2a09
commit
46037de01c
|
|
@ -1,20 +1,23 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import {Cron} from '@nestjs/schedule';
|
||||
import {StarsService} from "@gitroom/nestjs-libraries/database/prisma/stars/stars.service";
|
||||
import {BullMqClient} from "@gitroom/nestjs-libraries/bull-mq-transport/client/bull-mq.client";
|
||||
import { Cron } from '@nestjs/schedule';
|
||||
import { StarsService } from '@gitroom/nestjs-libraries/database/prisma/stars/stars.service';
|
||||
import { BullMqClient } from '@gitroom/nestjs-libraries/bull-mq-transport/client/bull-mq.client';
|
||||
|
||||
@Injectable()
|
||||
export class CheckStars {
|
||||
constructor(
|
||||
private _starsService: StarsService,
|
||||
private _workerServiceProducer: BullMqClient
|
||||
) {
|
||||
constructor(
|
||||
private _starsService: StarsService,
|
||||
private _workerServiceProducer: BullMqClient
|
||||
) {}
|
||||
@Cron('0 0 * * *')
|
||||
async checkStars() {
|
||||
const allGitHubRepositories =
|
||||
await this._starsService.getAllGitHubRepositories();
|
||||
for (const repository of allGitHubRepositories) {
|
||||
this._workerServiceProducer.emit(
|
||||
'check_stars',
|
||||
JSON.stringify({ payload: { login: repository.login } })
|
||||
);
|
||||
}
|
||||
@Cron('0 0 * * *')
|
||||
async checkStars() {
|
||||
const allGitHubRepositories = await this._starsService.getAllGitHubRepositories();
|
||||
for (const repository of allGitHubRepositories) {
|
||||
this._workerServiceProducer.emit('check_stars', JSON.stringify({login: repository.login}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue