Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.45k stars 862 forks source link

Question: Is it possible to use async await for process function? #1211

Closed Pistacchione closed 5 years ago

Pistacchione commented 5 years ago

Hi,

is it possible to use async function for queue.process like this:

queue.process('test', 5, async (job, done) => {
  try {
    const result = await someAsyncFunction(job.data)
    done()
  } catch (err) {
    done(err)
  }
})

Thanks Matteo

Pistacchione commented 5 years ago

Hi,

I have tested async/await processes and they seem to work properly.

Thanks

arthursoas commented 5 years ago

How did you solve that?

Pistacchione commented 5 years ago

How did you solve that?

Like the code snippet in my first question