Skip to content
Sad Subscription Analytics
Menu

Cron and Action Scheduler

SadAnalytics never calls Stripe, or does any real work, while a visitor is loading a page. Everything happens in the background, driven by WordPress's own scheduler and a bundled library called Action Scheduler.

Why nothing runs on page load

A sync, the weekly digest, and every recalculation SadAnalytics does are all scheduled events, not something triggered by a visitor opening a page. A visitor's page view can wake WP-Cron, but the work runs in a separate background request, never inside the page they're loading. That is deliberate: it keeps SadAnalytics from adding any load to the pages your customers actually browse.

What needs WP-Cron or a system cron

WordPress's own scheduler, WP-Cron, only fires when a request reaches the site: someone visiting a page, or a logged-in admin loading wp-admin. On a low-traffic site, that can mean hours between the moments WP-Cron gets a chance to run anything at all, which is why a real system cron hitting the site on a fixed schedule (or a steady trickle of visitors) matters more here than on many plugins.

SadAnalytics re-derives its own sync schedule from your saved frequency on every admin or cron request, so a missing or wrong scheduled event repairs itself the next time anyone loads wp-admin. It cannot repair a request that never arrives in the first place.

The cron-health notice

If SadAnalytics is configured and the oldest overdue event in WordPress's cron table is running two hours or more behind schedule, far beyond normal jitter, SadAnalytics shows a warning on its own admin pages.

The notice can be dismissed, and once dismissed it will not come back for that WordPress user even if cron falls behind again later. A healthy site, or one already running on a real system cron, never sees it.

An admin notice warning that scheduled tasks on the site are running well behind, so syncs and email reports may be delayed, with advice to ask your host for a real server cron.
The warning shown when WordPress cron is running two or more hours behind.

Action Scheduler, the engine behind every sync step

SadAnalytics bundles a library called Action Scheduler to run every step of a sync in the background, one small batch at a time, instead of in one long request. The official ZIP always includes it, so most sites never see the notices below; they exist for a damaged install or a developer checkout.

What you seeWhat it means
"Action Scheduler not found. Please reinstall the plugin."A required file is missing from the install. Re-uploading the plugin ZIP fixes it.
A notice that Action Scheduler could not start, telling you to deactivate and reactivate the plugin, or run composer install in the plugin directoryEverything else in SadAnalytics still works, pages, reports, settings, but sync cannot start until this clears.

Seeing what is queued

Action Scheduler keeps its own admin screen under Tools, then Scheduled Actions, where every pending, running or failed SadAnalytics background job is listed under the group sadanalytics-sync. See the sync looks stuck for how to read that list.