hullo i just across this today, could either be a local thing or swapping to `promise.allSettled`, e

hullo i just across this today, could either be a local thing or swapping to
promise.allSettled
, eg

async queue(batch, env, ctx) { 
  await Promise.allSettled(
    batch.messages.map((message) => processBody(message.body)
      .then(() => {
        // maybe `res?.ok` if its a fetch or something
        message.ack()
      })
      .catch(() => {
        message.retry()
      })
  )).finally(() => {
    console.log('batch completed')
  })
}
Was this page helpful?