Why are there so many cron schedules on my site?

You might have installed some tool to find out what cron jobs are running on your site (like WP Crontrol or Debug Bar Cron). And you may have been alarmed to see something like this:


Even worse, they are set for every 5 minutes, so does that mean EWWW is running 5 tasks on your site every 5 minutes???

Fortunately, the answer is No. The important thing to note is these are merely schedules. The existence of a schedule does NOT mean any jobs actually run on that schedule. For example, if you have the Debug Bar Cron plugin, you would look at the Custom Events to see what is actually running.

So what are those schedules used for? They are used to schedule "health checks" for background image optimization. To understand that, we need to know a little more about how background processing works:

For example, say you upload 10 images, and EWWW IO begins adding them to the queue. It fires off an asynchronous (AJAX) request for each image to begin processing the images in the queue. It uses a dual-queue system (A & B), so that images can be added to whichever queue is not currently running, and only one of the queues can run at a time.

Unless you enable Parallel mode, a single site can generally only have 1 image processing at a time. Parallel mode caps out at 5 images run at once, just in case you were curious, and it will ONLY be effective if you have more than 5 resizes generated per image upload AND you are not using any conversion options (WebP excluded).

So, if background mode starts almost right away, what in the world is the 5 minute interval for, right? The background queue attempts to avoid PHP timeouts by terminating execution prior to reaching the max_execution_time setting. It then spawns a new process via asynchronous request. BUT, it isn't always successful, so the 5 minute cron job is a health check to make sure background processing keeps running. When that very first image is added to the queue, the plugin schedules a health check. If the images finish optimizing in under 5 minutes, the health check is cancelled and never runs. If the images take longer (say you uploaded 100 images instead of just 10), the health check will see if the process is still running. If it isn't running, and there are images left in the queue, it just kicks the process off again. This repeats until all the uploaded images are completed, and then the health check is completely removed.

Still need help? Contact Us Contact Us