Created
January 19, 2022 09:15
-
-
Save ryanbekhen/b669bd9c76923197abce6a8f09c12201 to your computer and use it in GitHub Desktop.
Example remove failed queue Nest.js from service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InjectQueue } from '@nestjs/bull'; | |
import { Injectable } from '@nestjs/common'; | |
@Injectable() | |
export class ExampleService { | |
constructor( | |
@InjectQueue('simpool') private readonly exampleQueue: Queue | |
) {} | |
private async removeJob() { | |
const jobs = await this.simpoolQueue.getJobs(['failed']); | |
for (let i = 0; i < jobs.length; i++) { | |
await jobs[i].remove(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment