Execute Function
The executable function will be run after your setup function has finished. It must return an array of cron jobs. In this example we define the two required cron jobs: the task job and the validate and vote job. The task job submits the task results to K2 and validate and vote, validates each node and submits votes to K2.
* @description Execute function is called just after the setup function to run Submit, Vote API in cron job
* @returns return all cron schedule from execute function for graceful termination
async function execute() {
let cronArray = [];
if (process.env.NODE_MODE == NODE_MODE_SERVICE) {
cron.schedule('*/1 * * * *', task),
cronArray.push(cron.schedule('*/1 * * * *', () => { namespace.validateAndVoteOnNodes(validateNode) }));
return cronArray;
Copy link