How to use the bee-queue/lib/lua.buildCache function in bee-queue

To help you get started, we’ve selected a few bee-queue 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 stitchng / adonis-queue / src / Queue / index.js View on Github external
.save(async (err, $job) => { // See: https://github.com/bee-queue/bee-queue/issues/147
          if (err) {
            console.error(`@@adonisjs/Queue: failed in creating job id=${this._jobUuid} on queue: ${_name}`)

            // Known error when redis has not all lua scripts loaded properly
            if (err.command === 'EVALSHA') {
              await bqScripts.buildCache(this.getByName(_name))
              console.info(`@@adonisjs/Queue: successfully reloaded Lua scripts into cache; retrying job creation id=${this._jobUuid}`)

              // try to create job again
              try {
                await queue.removeJob(this._jobUuid)
              } catch (ex) { $job = null } finally {
                _job = $job || queue.createJob(job.makeArg(job))

                _job.setId(this._jobUuid)
                  .timeout(job.timeOut || 0)
                  .backoff('fixed', job.retryUntil || 0)
                  .retries(job.retryCount || 2)
                  .delayUntil(job.delayUntil || 0)
                  .save()
              }
            }

bee-queue

A simple, fast, robust job/task queue, backed by Redis.

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis

Popular bee-queue functions