make constants more explicitly accessible

This commit is contained in:
2016-04-25 14:21:28 -07:00
parent a4bfd5184d
commit a46d8621cc
2 changed files with 4 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
const constants = { export const jobStatuses = {
JOB_STATUS_PENDING: 'pending', JOB_STATUS_PENDING: 'pending',
JOB_STATUS_PROCESSING: 'processing', JOB_STATUS_PROCESSING: 'processing',
JOB_STATUS_COMPLETED: 'completed', JOB_STATUS_COMPLETED: 'completed',
JOB_STATUS_FAILED: 'failed', JOB_STATUS_FAILED: 'failed',
}; };
export default constants; export default Object.assign({}, jobStatuses);

View File

@@ -1,7 +1,7 @@
import events from 'events'; import events from 'events';
import { isPlainObject } from 'lodash'; import { isPlainObject } from 'lodash';
import logger from './helpers/logger'; import logger from './helpers/logger';
import { JOB_STATUS_PENDING } from './helpers/constants'; import { jobStatuses } from './helpers/constants';
import createIndex from './helpers/create_index'; import createIndex from './helpers/create_index';
const debug = logger('job'); const debug = logger('job');
@@ -33,7 +33,7 @@ export default class Job extends events.EventEmitter {
created_at: new Date(), created_at: new Date(),
attempts: 0, attempts: 0,
max_attempts: this.maxAttempts, max_attempts: this.maxAttempts,
status: JOB_STATUS_PENDING, status: jobStatuses.JOB_STATUS_PENDING,
} }
}) })
.then((doc) => { .then((doc) => {