Converting recursive function to node-cron job

156 Views Asked by At

I'd like to convert a recursive function with setTimeout to a node-cron job, but am not sure how to return the parameters:

async function Infinite(page, initData, updateData = new Map()) {
  // Check for updates
  // If found add to updateData
  // Delay function
  return Infinite(page, initData, updateData);
}

to

 cron.schedule('*/15 8-18 * * *', (/*page, initData, updateData = new Map() ??*/) => {
  // Check for updates
  // If found add to updateData
  // return ???
 }

I imagine there will need to be IIFE placed in there somewhere, any help is welcome!

0

There are 0 best solutions below