fix scoping issue, add debugging on worker register

This commit is contained in:
2016-05-10 17:28:27 -07:00
parent aa5ea72e3b
commit 38532a6296

View File

@@ -26,6 +26,7 @@ export default class Job extends events.EventEmitter {
this.debug = (...msg) => debug(...msg, `id: ${this.id}`); this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
this._checker = false; this._checker = false;
this.debug(`Created worker for type ${this.type}`);
this._startJobPolling(); this._startJobPolling();
} }
@@ -118,7 +119,7 @@ export default class Job extends events.EventEmitter {
const workerOutput = new Promise((resolve, reject) => { const workerOutput = new Promise((resolve, reject) => {
resolve(this.workerFn.call(null, job._source.payload)); resolve(this.workerFn.call(null, job._source.payload));
setTimeout(function () { setTimeout(() => {
this.debug(`Timeout processing job ${job._id}`); this.debug(`Timeout processing job ${job._id}`);
reject(new WorkerTimeoutError({ reject(new WorkerTimeoutError({
timeout: job._source.timeout, timeout: job._source.timeout,