add optional debugging output

This commit is contained in:
2016-04-25 10:52:58 -07:00
parent b78c5763ce
commit b907c0ed71
4 changed files with 18 additions and 2 deletions

View File

@@ -1,10 +1,13 @@
import events from 'events';
import createClient from './helpers/es_client';
import indexTimestamp from './helpers/index_timestamp';
import logger from './helpers/logger';
import Job from './job.js';
import Worker from './worker.js';
import { omit } from 'lodash';
const debug = logger('queue');
export default class Elastique extends events.EventEmitter {
constructor(index, options = {}) {
if (!index) throw new Error('Must specify an index to write to');
@@ -21,12 +24,14 @@ export default class Elastique extends events.EventEmitter {
}
_initTasks() {
var initTasks = [
this.client.ping({ timeout: 3000 }),
];
return Promise.all(initTasks);
return Promise.all(initTasks).catch((err) => {
debug('Initialization failed', err);
throw err;
});
}
add(type, payload, opts = {}) {