The Kickq Job Item

Thanasis Polychronakis edited this page Aug 23, 2015 · 4 revisions

The Job Item contains all the essential information of a job. It is passed on every Kickq callback. The Job Item object is dispensable, it is a clone of the actual job item instance so you can manipulate it freely.

This is the breakout:

// job
  id: '0', // {string | null} the job id, null on error.
  name: 'job name', // {string} the job name.
  complete: false, // {boolean} irrespective of success / fail.
  success: false, // {boolean} turns true when complete and executed with success.
  createTime: 1364226587925, // {number} JS timestamp.
  finishTime: null, // {number | null} JS timestamp or null.
  totalProcessTime: null, // {number | null} total process time in ms or null.

  // the state can be one of:
  //   - new
  //   - queued :: A job has been queued for re-processing
  //   - delayed
  //   - processing
  //   - retry
  //   - ghost   :: A re-process state when callback does not report.
  //   - success :: 'complete' flag is true
  //   - fail    :: 'complete' flag is true
  state: 'new',

  delay: null, // {number | null} Delay in milliseconds.

  retry: false, // {boolean} If this job will retry.
  retryCount: 5, // {number} How many times to retry.
  retryInterval: 1800000, // {number} milliseconds of interval between retrying.

  hotjob: false, // {boolean} If this is a hotjob.
  hotjobTimeout: 10000, // {number} milliseconds.
  hotjobPromise: null, // {when.Promise|null} The hotjob promise.

  data: null, // {*} Any type, passed data on job creation

  // {number | null} JS timestamp of when this job has been scheduled for.
  scheduledFor: null,

  // Processing runs performed for this job. Can be 1 up to n retries.
  // When the job is new this is an empty array.
  runs: [
    // a process item
      count: 1, // {number} the process count of this process item.
      startTime: 1364226587925, // {number} JS timestamp
      processTimeout: 10000, // {?number} Processing timeout in ms.
      processTime: null, // {?number} Processing time in ms or null

      // same as job.state except states: 'new', 'delayed', 'retry'
      state: 'processing',
      error: null // {?Error} Error message of processing item originating from consumer.