Merge branch 'develop'
This commit is contained in:
10
package.json
10
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "esqueue",
|
||||
"version": "0.2.1",
|
||||
"description": "",
|
||||
"version": "0.2.2",
|
||||
"description": "Job queue, powered by Elasticsearch",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build": "rm -rf lib && babel src --out-dir lib",
|
||||
@@ -11,6 +11,12 @@
|
||||
"unit": "nyc --require babel-core/register mocha test/src/**"
|
||||
},
|
||||
"author": "Joe Fleming (https://github.com/w33ble)",
|
||||
"keywords": [
|
||||
"job",
|
||||
"queue",
|
||||
"worker",
|
||||
"elasticsearch"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/w33ble/esqueue.git"
|
||||
|
||||
@@ -36,6 +36,7 @@ export default class Job extends events.EventEmitter {
|
||||
payload: this.payload,
|
||||
priority: this.priority,
|
||||
timeout: this.timeout,
|
||||
process_expiration: new Date(0), // use epoch so the job query works
|
||||
created_at: new Date(),
|
||||
attempts: 0,
|
||||
max_attempts: this.maxAttempts,
|
||||
|
||||
@@ -26,6 +26,7 @@ export default class Job extends events.EventEmitter {
|
||||
this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
|
||||
|
||||
this._checker = false;
|
||||
this.debug(`Created worker for type ${this.type}`);
|
||||
this._startJobPolling();
|
||||
}
|
||||
|
||||
@@ -118,7 +119,8 @@ export default class Job extends events.EventEmitter {
|
||||
const workerOutput = new Promise((resolve, reject) => {
|
||||
resolve(this.workerFn.call(null, job._source.payload));
|
||||
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
this.debug(`Timeout processing job ${job._id}`);
|
||||
reject(new WorkerTimeoutError({
|
||||
timeout: job._source.timeout,
|
||||
jobId: job._id,
|
||||
|
||||
Reference in New Issue
Block a user