How to use the actionhero.api.tasks function in actionhero

To help you get started, we’ve selected a few actionhero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({params}) {
    let failed = await api.tasks.failed(params.id, params.id)
    if (!failed) { throw new Error('failed job not found') }
    await api.tasks.retryAndRemoveFailed(failed[0])
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response}) {
    response.resqueDetails = await api.tasks.details()
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({params}) {
    let failed = await api.tasks.failed(params.id, params.id)
    if (!failed) { throw Error('failed job not found') }
    await api.tasks.removeFailed(failed[0])
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response, params}) {
    response.count = await api.tasks.delLock(params.lock)
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response, params}) {
    let timestamps = []
    let delayedjobs = {}

    response.timestampsCount = 0
    let allTimestamps = await api.tasks.timestamps()
    if (allTimestamps.lenght === 0) { return }

    response.timestampsCount = allTimestamps.length

    for (let i = 0; i < allTimestamps.length; i++) {
      if (i >= params.start && i <= params.stop) { timestamps.push(allTimestamps[i]) }
    }

    for (let j in timestamps) {
      let timestamp = timestamps[j]
      delayedjobs[timestamp] = await api.tasks.delayedAt(timestamp)
    }

    response.delayedjobs = delayedjobs
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({params, response}) {
    response.queueLength = await api.resque.queue.length(params.queue)
    response.jobs = await api.tasks.queued(params.queue, params.start, params.stop)
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response}) {
    response.workerQueues = await api.tasks.workers()
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response}) {
    response.locks = await api.tasks.locks()
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run ({response, params}) {
    response.deleted = await api.tasks.delQueue(params.queue)
  }
}
github actionhero / ah-resque-ui / actions / ah-resque-ui.js View on Github external
async run () {
    let failed = await api.tasks.failed(0, 0)
    if (failed && failed.length > 0) {
      let failedJob = failed[0]
      await api.tasks.retryAndRemoveFailed(failedJob)
      return this.run()
    }
  }
}