add optional created_by record to the doc

This commit is contained in:
2016-05-16 15:01:36 -07:00
parent 31159baae9
commit 8d21dc6967
3 changed files with 23 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ export default class Job extends events.EventEmitter {
this.index = index;
this.jobtype = type;
this.payload = payload;
this.created_by = options.created_by || null;
this.timeout = options.timeout || 10000;
this.maxAttempts = options.max_attempts || 3;
this.priority = Math.max(Math.min(options.priority || 10, 20), -20);
@@ -37,6 +38,7 @@ export default class Job extends events.EventEmitter {
jobtype: this.jobtype,
payload: this.payload,
priority: this.priority,
created_by: this.created_by,
timeout: this.timeout,
process_expiration: new Date(0), // use epoch so the job query works
created_at: new Date(),
@@ -87,6 +89,7 @@ export default class Job extends events.EventEmitter {
index: this.index,
type: this.doctype,
jobtype: this.jobtype,
created_by: this.created_by,
payload: this.payload,
timeout: this.timeout,
max_attempts: this.maxAttempts,