Skip to content

v3.2.0

Choose a tag to compare

@ramipellumbi ramipellumbi released this 29 Nov 03:32
· 31 commits to main since this release
  • Add option to pass in multiple cron patterns to a Clujo. The Clujo will execute on each pattern, with overlapping execution prevented in the case of an overlap. For example, only one execution will occur in the below:
const taskGraphRunner = new TaskGraph()
    .addTask({
        id: "task1",
        execute: ({ deps, ctx }) => {
            console.debug("Task 1 executing");
            await sleep(100);
            console.debug("Task 1 executed");
            return "Task 1 result";
        },
        dependencies: [],
    })
    .build();

const clujo = new Clujo({
    id: "test",
    cron: {
        // every 10 seconds cron pattern and every 5 seconds
        patterns: ["*/10 * * * * *", "*/5 * * * * *"] ,
    },
    taskGraphRunner,
});
  • Default to preventing overlapping executions in the single pattern, non Redis locking, single instance case. This can be changed by passing in protect: false in the cron.options of the Clujo constructor.