[Ask ML]: Are any of you using cron jobs?

I'm looking into how to do cron jobs well for NextJS apps deployed on Vercel or Netlify.

There are very popular ways of handling this:

  • Ruby on Rails has Sidekiq
  • .NET has Hangfire
  • Celery for Django (Thanks Sergio)

Do you know of something similar in the NextJS / Node world?

I'm considering SaaS and run-it-yourself open source solutions.

If I can't find what I'm looking for, I'm considering building something.

Thanks.

Hi! I'm not using cron jobs per-se, but using Celery's beat feature (task scheduling which integrates right into the task queue). It's pretty fire!

0 Likes

I'm personally using Agenda because has a good scheduler API.

Other devs - I think the majority of Node devs - are using Bull, that is more similar to Sidekiq since it's using Redis.

As 98% of the questions for a new part of a dev architecture, the response is: it depends. If you have only 1-2 tasks done everyday (like backing up the database) cron jobs is great. If you need flexibility, create delayed jobs in the future that needs to be processed even if the server restarts it's better if you use something like Agenda or Bull.

A third party service is also a good idea! But you need to expose some APIs to be used as webhook, so you need to be extra careful about security and don't expose them to Google search spiders (I saw some pretty dab things some years ago done by other devs about this…)

0 Likes
Sid

I've used bull in the past and was pretty happy with it

0 Likes
Micah Iverson

We use various cron jobs within Azure, to check subscription status, send emails, etc.

0 Likes
Drew Bredvick Author

Good to know! What has been the hardest part of using those?

0 Likes
Micah Iverson

@dbredvick I guess they are called Web Jobs in Azure, I am not sure how hard they are to use, my dev always sets that part up for our projects. I don't think it's all that hard, basically creating a console app I think. https://docs.microsoft.com/en-us/azure/app-service/webjobs-dotnet-deploy-vs

0 Likes
Sumit Datta

If there are only a couple of tasks, why not simply a crontab?

I have not used cron in a while but I am surprised no one uses the native cron… :|

0 Likes
Drew Bredvick Author

I agree that crontab would be the way to go in some cases.

0 Likes

I have a boosted app on glitch that uses node-cron.

That's literally it

It's the simplest setup I've seen and you can clone it here

0 Likes

Please sign in to leave a comment.