remove job options passing

This commit is contained in:
2016-04-19 14:58:02 -07:00
parent e88695a989
commit df8bd2123b
2 changed files with 9 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ import { isPlainObject, omit } from 'lodash';
import { JOB_STATUS_PENDING } from './helpers/constants';
export default class Job extends events.EventEmitter {
constructor(queue, type, payload, options = {}) {
constructor(queue, type, payload, timeout = 10000) {
if (typeof type !== 'string') throw new Error('Type must be a string');
if (!isPlainObject(payload)) throw new Error('Payload must be a plain object');
@@ -12,8 +12,7 @@ export default class Job extends events.EventEmitter {
this.queue = queue;
this.type = type;
this.payload = payload;
this.timeout = options.timeout || 10000;
this.options = omit(options, [ 'timeout' ]);
this.timeout = timeout;
this.status = JOB_STATUS_PENDING;
this.ready = this.queue.client.index({
@@ -22,7 +21,6 @@ export default class Job extends events.EventEmitter {
body: {
payload: this.payload,
timeout: this.timeout,
options: this.options,
created: new Date(),
started: null,
completed: null,