tweak the schema a bit
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
var schema = {
|
var schema = {
|
||||||
payload: { type: 'object', enabled: false },
|
payload: { type: 'object', enabled: false },
|
||||||
priority: { type: 'short' },
|
priority: { type: 'short' },
|
||||||
process_timeout: { type: 'long' },
|
timeout: { type: 'long' },
|
||||||
process_expiration: { type: 'date' },
|
process_expiration: { type: 'date' },
|
||||||
created_at: { type: 'date' },
|
created_at: { type: 'date' },
|
||||||
started_at: { type: 'date' },
|
started_at: { type: 'date' },
|
||||||
|
|||||||
@@ -18,21 +18,18 @@ export default class Job extends events.EventEmitter {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.payload = payload;
|
this.payload = payload;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
this.status = JOB_STATUS_PENDING;
|
|
||||||
|
|
||||||
this.ready = createIndex(client, index)
|
this.ready = createIndex(client, index)
|
||||||
.then((...args) => {
|
.then(() => {
|
||||||
this.client.index({
|
this.client.index({
|
||||||
index: this.index,
|
index: this.index,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
body: {
|
body: {
|
||||||
payload: this.payload,
|
payload: this.payload,
|
||||||
timeout: this.timeout,
|
timeout: this.timeout,
|
||||||
created: new Date(),
|
created_at: new Date(),
|
||||||
started: null,
|
|
||||||
completed: null,
|
|
||||||
attempts: 0,
|
attempts: 0,
|
||||||
status: this.status,
|
status: JOB_STATUS_PENDING,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((doc) => {
|
.then((doc) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user