make constants more explicitly accessible
This commit is contained in:
@@ -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);
|
||||||
@@ -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) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user