Closed aryamannaik closed 2 months ago
You will need to ensure your node process does not exit, in a similar way you would keep a HTTP listener running for an API
Thanks @timgit. Would it be worth updating the README to have a complete example here?
Another option would be to provide an API that runs work
and does not exit. See graphile-worker
's implementation here for some inspo!
I'm trying to follow the README example in typescript. I have pg-boss 9.0.3 installed via
yarn add pg-boss
.My goal is to simply queue a job, and then process this via
work
. My expectation is that once I callwork
it will process jobs infinitely.I'm running the following script:
I'm also able to verify in my local PG that this job is sent in the
job
table.However, my script returns immediately, and I don't see any of the output from the
someAsyncJobHandler
function.Am I misunderstanding how the
work
function is supposed to work?My read from this was that the worker would poll infinitely.
My higher level goal here is to use the
work
function in my worker service threads that will process jobs send to pg-boss viasend
from the application code that handles user requests. Is my understanding here incorrect, or is this a bug?