Skip to content

Instantly share code, notes, and snippets.

@ryanbekhen
Created January 19, 2022 09:15
Show Gist options
  • Save ryanbekhen/b669bd9c76923197abce6a8f09c12201 to your computer and use it in GitHub Desktop.
Save ryanbekhen/b669bd9c76923197abce6a8f09c12201 to your computer and use it in GitHub Desktop.
Example remove failed queue Nest.js from service
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