Closed omar-dulaimi closed 2 years ago
What does your job createUrlJobs
look like?
Also, do you have a typo here?
It currently exists the program once it finishes executing the job.
"Exists" -> "Exits"?
Have you tried running NODE_DEBUG=bree node app.js
?
What version of Bree are you using?
@titanism I meant exits, my bad.
The createUrlJobs
job has another bree instance.
const bree = new Bree({
doRootCheck: false,
});
(async () => {
await bree.start();
for (const clientEndpoint of clientEndpoints) {
const url = `https://${clientEndpoint}`;
const duration = randomDuration(1, 59);
await bree.add([
{
name: `capture-url-${clientEndpoint}`,
path: path.resolve(__dirname, "capture-url.js"),
date: dayjs().add(duration, "seconds").toDate(),
worker: {
workerData: {
clientEndpoint,
url,
},
},
},
]);
await bree.run(`capture-url-${clientEndpoint}`);
}
})();
Using ^9.0.1
bree.run
will not consider interval
, it only runs a job once
If you want jobs to start on an interval or schedule, use bree.start
Ref https://github.com/breejs/bree/blob/master/src/index.js (look at the start and run functions)
@titanism Thanks man. I missed this part in the README:
// run all jobs (this does not abide by timeout/interval/cron and spawns workers immediately)
Describe the bug
Node.js version: v14.19.3
OS version: Ubuntu 18.04
Description:
Hello
I'm facing a weird issue, where a job with
1m
interval does not repeat itself.Actual behavior
It currently exits the program once it finishes executing the job.
Expected behavior
It should not exit, knowing that the interval is
1m
Code to reproduce
Checklist
Note: I have tested the issue with both node 14 and 16, I couldn't with node 18 since it requires me to upgrade my OS.