Closed Eomm closed 3 months ago
I was wondering if the expire_in_seconds should set a job's state to expired instead of error here:
expire_in_seconds
expired
https://github.com/timgit/pg-boss/blob/f1c1636caf9518ec9cd3fe0d0e2844ee98179e68/src/manager.js#L225-L227
I was able to get an exipired state only when the job is active and I stop and restart pg-boss. Is this expected?
exipired
Example:
'use strict'; const PgBoss = require('pg-boss'); buildConsumer(); async function buildConsumer () { const boss = new PgBoss({ user: 'postgres', password: 'postgres', schema: 'postgres', }); await boss.start(); const jobId = await boss.send('queueName', { body: 'foo' }, { expireInSeconds: 2 }); console.log('š£ Inserted job'); await boss.work( 'queueName', { teamSize: 1, newJobCheckInterval: 100, }, async () => { console.log('š Started SLOW job'); await new Promise((resolve) => setTimeout(resolve, 5_000)); console.log('Done job'); const job = await boss.getJobById(jobId); console.log({ job }); // āļø state: 'failed', message: 'handler execution exceeded 2000ms' }, ); console.log('š£ Start worker'); process.on('SIGINT', async () => { console.log('š£ Stopping'); await boss.stop(); console.log('š£ Stopped'); process.exit(); }); }
The expired state will be obsolete in v10 to make this more consistent
I was wondering if the
expire_in_seconds
should set a job's state toexpired
instead of error here:https://github.com/timgit/pg-boss/blob/f1c1636caf9518ec9cd3fe0d0e2844ee98179e68/src/manager.js#L225-L227
I was able to get an
exipired
state only when the job is active and I stop and restart pg-boss. Is this expected?Example: