Skip to content

Instantly share code, notes, and snippets.

@bibhuticoder
Created July 29, 2021 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibhuticoder/dca1610eded55b3b2bf6a9592e769c58 to your computer and use it in GitHub Desktop.
Save bibhuticoder/dca1610eded55b3b2bf6a9592e769c58 to your computer and use it in GitHub Desktop.
import cron from 'node-cron';
import instaCacheCron from "./crons/instaCache.cron";
// run immediately after server starts
instaCacheCron();
// update instaPhotos Cache every 3 hours
cron.schedule('0 0 */3 * * *', async () => {
// this method fetches updated Insta images and saves to DB.
await instaCacheCron();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment