Looking for experience with implementing cron functionality in Vanilla
Hi all. We are doing some research into implementing cron functionality into vanilla core. I noticed that @businessdad made a plugin that does this and it looks very promising. However, it does require some sort of cron ability on your web host. We need to have a fall back.
I just want to see if anyone has any experience with other projects that implement some sort of cron ability in a nice way. The way I see it is we have two scenarios.
Webhost has native cron functionality and the forum administrator knows how to use it.
This is the best case for us. We can make an endpoint such as /cron that gets pinged by the real cron job. This will work well and will be performant. The downside of course is that many web hosts don't offer cron functionality and setting it up is too difficult for a lot of people.
Webhost doesn't have cron functionality or the forum administrator doesn't know how to use it.
Traditionally, I've seen other projects check to run a cron job on every postback or launch an ajax request to do so. The check would have to check for jobs and then run them. This process works without any additional setup however it has downsides too.
Doing a check every postback adds a lot of traffic to the site. Usually hosts that don't allow cron also don't allow too much traffic either.
There is the possibility of a race condition where two processes may grab the same cron job at the same time.
What should we do?
I think we need a good non-native cron way of implementing cron or else we just can't do it. I'm hoping other people have seen this problem solved reasonably well in other projects. Any ideas?