i am using simpleddp by @gregivy. I am calling a method, to start a job (which successfully does as i can see it in DB). Then a worker picks up this job, runs it and changes its status to ‘finished’.
const jobId = await ddp.call("job.start", { options });
const jobsSub = ddp.subscribe("jobs");
await jobsSub.ready();
const reactiveCursor = ddp.collection('jobs').filter(j => j._id === jobId).reactive().one();
reactiveCursor.onChange((newData) => {
console.log(newData);
// Do my calculations here
});
My code never seems to get in the onChange
event.
How do i listen when the job status changes to “finished”, so i can proceed with the result of the job calculations?
Please keep in mind that this can be a heavy calculation that takes few seconds to a couple of minutes to finish.