Skip to content

Commit

Permalink
measure how many active jobs we have for disabled accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbert Takacs committed Jul 12, 2023
1 parent ac5a8e1 commit 26b93c5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rss/rss.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ export class RssService implements OnModuleInit {
where: { chat_id: dto.chatId },
data: { disabled: dto.disable }
});
const activeJobs = await this.messagesQueue.getJobs(["waiting", "delayed"]);

let countOfActiveJobs = 0;

for (let i = 0; i < activeJobs.length; i++) {
const job = activeJobs[i];
if (job.data.chatId === dto.chatId) {
countOfActiveJobs++;
}
}

console.log("DISABLED USER ACTIVE JOBS: " + countOfActiveJobs);
}

async disableFeed(dto: { name: string; disable: boolean }) {
Expand Down

0 comments on commit 26b93c5

Please sign in to comment.