Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

337
Visualizações
node-cron vs setInterval() in setting a database checker job that runs every minute

I was looking on how to implement post scheduling feature in my app, then I discovered node-cron. So theoretically, I can do it using node-cron where the cron job will run every minute and checks the database if a post is due to be posted, and finally post it to the newsfeed.

Then I remembered setInterval(). Javascript setInterval() I think also do the exact same thing with using node-cron. What could be the difference between these two? If setInterval() would also do the job without problems, then I think I should go with it, since it's simpler and native javascript function.

What do you think? I've been searching for answers, but it seems that the opinions for this is 50/50, and there's not much discussion about this matter. Some recommend just using setInterval() if i'm not planning to set a specific date/time. That's right I only wanted to run my job every minute, but then I also read about memory leak in setInterval() which I don't understand fully.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda