Understanding the WP Cron

Matador uses the WordPress Cron feature to manage auto sync. It is a little confusing about how it works, so we’d love to explain it to you since it is such an important part of how Matador works.

First, lets define “cron”. A “cron” refers to a program, usually in a Unix-based computer system which power most of our web hosts, that executes tasks on a regular schedule. Think of them as little alarm clocks that wake up the computer, and then tells the computer to do something. Cron tasks always run on time. Its like if you hire a housekeeper to come to your place and do chores for you and every night they take out the trash; a cron will always make sure the trash gets taken out. Setting up cron tasks can be difficult and require advanced access to your server and advanced knowledge of server configuration. When making Matador, we don’t expect our users to know how to set up crons. So we didn’t design Matador to use them.

We did design Matador, however, to use “WP Cron”. Now, despite the similar name, WP Cron is very different. It is a core feature of WordPress, and it too handles recurring scheduled events. Unlike crons, which go off without fail on a regular schedule, a WP Cron goes off on the next page load after the schedule has passed. So lets say you live alone and do your own chores and one is to take out the trash every night, but one night you go over to a friend’s and choose to stay the night. Because you weren’t home to take out the trash, it didn’t get taken out. Same with WP Cron. It won’t run the cron unless someone is using the site. We may schedule Matador to sync hourly, but if no one visits your page for three hours (common in the late night, for example), the cron won’t run until someone (or a bot) loads the page. Even if we set the schedule to run cron every 5 seconds, unless a page on the site is loaded every 5 seconds, you’ll never get that frequency.

Since WP Cron runs with page loads, any user, whether one of you or one of your clients, can trigger the cron. Matador’s sync routine, relative to most functions in WordPress, it time consuming. On PHP 7, WordPress loads in under a half second, but a WordPress running a Matador sync with Bullhorn can take between 2.5 and 4 seconds. Because some site visitors might abandon a site that loads slowly, we discourage you from having too regular a schedule for your WP cron, which is why we’ve settled on once hourly.

If you’d like to adjust the frequency of your Matador Auto Syncs, to be more or less regular, we’ve set up a guide. If you’d like to see how to manually force a sync without waiting for an auto sync, here is a guide on how to do that.

Was this article helpful?
Yes 0 No 0