code: function processJob (db, generator, job, webhookOptions) {
    return generator(job.url, job)
      .then(function (response) {
        return _logGeneration(db, job.id, response)
          .then(function (logResponse) {
            if (!error.isError(response)) {
              debug('Job %s was processed, marking job as complete.', job.id)
  
              return Promise.all([
                _markAsCompleted(db, job.id),
                _setStorage(db, job.id, response.storage)
              ]).then(function () {
                if (!webhookOptions) {
                  return response
                }
  
                // Re-fetch the job as storage has been added
                return getById(db, job.id).then(function (job) {
                  // Important to return promise otherwise the npm cli process will exit early
                  return attemptPing(db, job, webhookOptions)
                    .then(function() {
                      return response
                    })
                })
              })
            }
  
            return response
          })
      })
  }
docs: ========== PROCESSING ==========