Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,25 @@ process.on('uncaughtException', async () => {
process.exit(1);
});
```
#### Queue#isRunning()

Returns `true` unless the Queue is shutting down due to a call to `Queue#close()`.

#### Queue#ready([cb])

Promise resolves to the queue (or callback is called wth `null` argument) when the queue (and Redis) are ready for jobs. Learn more about `'ready'` in [Queue Local Events](#queue-local-events).

```js
const Queue = require('bee-queue');
const queue = new Queue('example');
queue.ready()
.then(async (queue) => {
console.log('isRunning:', queue.isRunning());
const checkHealth = await queue.checkHealth();
console.log('checkHealth:', checkHealth);
})
.catch((err) => console.log('unreadyable', err));
```

#### Queue#removeJob(jobId, [cb])

Expand Down Expand Up @@ -686,7 +705,7 @@ The job has sent a [progress report](#jobreportprogressn) of `progress` percent.

### Methods

Each Job can be configured with the commands `.setId(id)`, `.retries(n)`, `.backoff(strategy, delayFactor)`, `.delayUntil(date|timestamp)`, and `.timeout(ms)`.
Each Job can be configured with the chainable commands `.setId(id)`, `.retries(n)`, `.backoff(strategy, delayFactor)`, `.delayUntil(date|timestamp)`, and `.timeout(ms)`.

#### Job#setId(id)

Expand Down
9 changes: 7 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ declare class BeeQueue {

getJob(jobId: string, cb: (job: BeeQueue.Job) => void): void;
getJob(jobId: string): Promise<BeeQueue.Job>;

getJobs(type: string, page: BeeQueue.Page, cb: (jobs: BeeQueue.Job[]) => void): void;
getJobs(type: string, page: BeeQueue.Page): Promise<BeeQueue.Job[]>;

Expand All @@ -45,6 +45,11 @@ declare class BeeQueue {
close(timeout?: number | null): Promise<void>;
close(timeout: number | undefined | null, cb: () => void): void;

isRunning(): boolean;

ready(): Promise<this>;
ready(cb: () => void): Promise<this>;

removeJob(jobId: string): Promise<void>;
removeJob(jobId: string, cb: () => void): void

Expand Down Expand Up @@ -78,7 +83,7 @@ declare namespace BeeQueue {
queue: BeeQueue;
progress: number;

on(ev: "succeeded", fn: (err: Error) => void): this;
on(ev: "succeeded", fn: (result: any) => void): this;
on(ev: "retrying", fn: (err: Error) => void): this;
on(ev: "failed", fn: (err: Error) => void): this;
on(ev: "progress", fn: (progress: number) => void): this;
Expand Down