From 4befaee4ccb9f4f60aa09e7d5dc907d864e9afe7 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 16 Dec 2016 16:42:18 -0700 Subject: [PATCH] minor syntax change make running more clearly a private state variable --- src/worker.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/worker.js b/src/worker.js index b26c162..94f34e3 100644 --- a/src/worker.js +++ b/src/worker.js @@ -31,17 +31,17 @@ export default class Job extends events.EventEmitter { this.checkInterval = opts.interval || 1500; this.checkSize = opts.size || 10; this.doctype = opts.doctype || constants.DEFAULT_SETTING_DOCTYPE; - this.running = true; this.debug = (...msg) => debug(...msg, `id: ${this.id}`); this._checker = false; + this._running = true; this.debug(`Created worker for job type ${this.jobtype}`); this._startJobPolling(); } destroy() { - this.running = false; + this._running = false; clearInterval(this._checker); } @@ -239,9 +239,10 @@ export default class Job extends events.EventEmitter { } _startJobPolling() { - if (!this.running) { + if (!this._running) { return; } + this._checker = setInterval(() => { this._getPendingJobs() .then((jobs) => this._claimPendingJobs(jobs));