timgit / pg-boss

Queueing jobs in Node.js using PostgreSQL like a boss
MIT License
1.79k stars 149 forks source link

Complete does not set status to 'completed' #346

Closed satyavh closed 1 year ago

satyavh commented 1 year ago
const jobId = 'c04e0650-3f17-11ed-b083-c37459551923'
const resp = await Boss.complete(jobId)

response

resp {
  jobs: [ 'c04e0650-3f17-11ed-b083-c37459551923' ],
  requested: 1,
  updated: 0
}

but then

const job = await Boss.getJobById(jobId)

results in state still being 'created'

{
  id: 'c04e0650-3f17-11ed-b083-c37459551923',
  name: 'queueName',
  priority: 0,
  data: {},
  state: 'created',
  retrylimit: 0,
  retrycount: 0,
  retrydelay: 0,
  retrybackoff: false,
  startafter: 2022-10-01T10:24:36.138Z,
  startedon: null,
  singletonkey: null,
  singletonon: null,
  expirein: PostgresInterval { minutes: 15 },
  createdon: 2022-09-28T10:24:36.150Z,
  completedon: null,
  keepuntil: 2022-10-15T10:24:36.138Z,
  on_complete: false,
  output: null
}

I've tried .fail() and .cancel() as well and these do set the correct state

timgit commented 1 year ago

A job first has to be in active state in order complete it