Has anyone had success long term, with having a job run every 2 minutes? I’m looking ahead in 9 months, when our job count would be close to 1 Million. Does that pose any issues?
Or perhaps, is there way to archive/delete completed jobs after xx months?
Just add a recurring job:
RecurringJob.AddOrUpdate(() => Console.WriteLine("Hello"), "*/2 * * * *");
Every two minutes Hangfire will create a new background job based on a recurring job and put its id to a queue. Worker will take id from a queue, fetch and process a job. If processing succeeded (no exception thrown), Hangfire will set an expiry (defaults to one day), and expiration manager will delete expired jobs.
We have ~100k scheduled jobs for the next year and ~5 mln completed over the past 3 months. We are running few recurring jobs that schedule ~5000 update jobs per day among other that are scheduled by users. We’re using SQL server storage and have had zero problems so far.
Thanks Nirinchev, that’s what I was looking forward to hearing. Good to know!