timgit / pg-boss

Queueing jobs in Postgres from Node.js like a boss
MIT License
2.15k stars 160 forks source link

Can an already started job be aware about a cancel request about it? #384

Closed iccicci closed 1 year ago

iccicci commented 1 year ago

Hi all, this is more a clarification request than an issue.

I'm wondering about the case when a job is started and it receives a cancel request while it is running; has the job some way to know about that?

Thank you in advance.

timgit commented 1 year ago

pg-boss will change the state of the job to cancelled if it's not completed or failed, but it will not interact with a worker awaiting a promise.

iccicci commented 1 year ago

Thank you @timgit ,

So ATM the only way a running job has to know it was cancelled is to polling the state of its job record; am I right?

timgit commented 1 year ago

Yes

iccicci commented 1 year ago

Thank you @timgit