Skip to content

Commit

Permalink
docs(remove-jobs): add clean method description
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Apr 5, 2023
1 parent 134f6ab commit 85c3049
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 19 additions & 2 deletions docs/gitbook/guide/queues/removing-jobs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Currently we have 2 available methods in queue class:
Currently we have 3 available methods in queue class:

# Drain

Removes all jobs that are waiting or delayed, but not active, completed or failed.
Removes all jobs that are waiting or delayed, but not active, waiting-children, completed or failed.

```typescript
import { Queue } from 'bullmq';
Expand All @@ -21,6 +21,22 @@ Parent jobs in queues different from the one being drained will either stay in *
have pending children in other queues, or just moved to wait.
{% endhint %}

# Clean

Removes jobs in specific state but keeps some withing a certain grace period.

```typescript
import { Queue } from 'bullmq';

const queue = new Queue('paint');

const deletedJobIds = await queue.clean(
60000, // 1 minute
1000, // max number of jobs to clean
'paused',
);
```

# Obliterate

Completely obliterates a queue and all of its contents.
Expand All @@ -41,4 +57,5 @@ have pending children in other queues, or just moved to wait.
## Read more:

- 💡 [Drain API Reference](https://api.docs.bullmq.io/classes/Queue.html#drain)
- 💡 [Clean API Reference](https://api.docs.bullmq.io/classes/Queue.html#clean)
- 💡 [Obliterate API Reference](https://api.docs.bullmq.io/classes/Queue.html#obliterate)
2 changes: 0 additions & 2 deletions docs/gitbook/patterns/process-step-jobs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Process Step Jobs

# Process Step jobs

Sometimes, it is useful to break processor function into small pieces that will be processed depending on the previous executed step, we could handle this kind of logic by using switch blocks:
Expand Down

0 comments on commit 85c3049

Please sign in to comment.