Skip to content

Commit

Permalink
feat(job): expose queueName
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored and manast committed Jun 11, 2021
1 parent d621359 commit 8683bd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ export class Job<T = any, R = any, N extends string = string> {
return (await this.isInList('wait')) || (await this.isInList('paused'));
}

get queueName(): string {
return this.queue.name;
}

/**
* @method getState
* Get current state.
Expand Down
1 change: 1 addition & 0 deletions src/classes/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { RedisClient } from './redis-connection';

export type MinimalQueue = Pick<
QueueBase,
| 'name'
| 'client'
| 'toKey'
| 'keys'
Expand Down
2 changes: 2 additions & 0 deletions src/test/test_flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ describe('flows', () => {

expect(children[0].job.id).to.be.ok;
expect(children[0].job.data.foo).to.be.eql('bar');
expect(children[0].job.queueName).to.be.eql(queueName);
expect(children[0].children).to.have.length(1);

expect(children[0].children[0].job.id).to.be.ok;
expect(children[0].children[0].job.queueName).to.be.eql(queueName);
expect(children[0].children[0].job.data.foo).to.be.eql('baz');

expect(children[0].children[0].children[0].job.id).to.be.ok;
Expand Down

0 comments on commit 8683bd4

Please sign in to comment.