Action Scheduler issues
On this page
Fix past-due background tasks, disabled WP-Cron and large task queues that delay queued emails, summaries and clean-ups in CRM-NG SMTP.
CRM-NG SMTP runs some work in the background with a library called Action Scheduler. When background tasks stop running, queued emails are delayed and clean-ups do not happen. This article explains what runs in the background and how to fix common problems. It is for administrators and developers.
What runs in the background
CRM-NG SMTP's background tasks belong to the group crmng_smtp. They include:
- Sending queued emails — when Optimize Email Sending or Email Rate Limiting is on (CRM-NG SMTP → Settings → Misc), emails wait in a queue and a background task sends them.
- Processing and cleaning the queue.
- Cleaning up old debug events — according to the Events Retention Period.
- Sending email summaries.
If you do not use the email queue, a stalled task usually just means late clean-ups. If you do use it, stalled tasks mean emails are not sent.
Where to see the tasks
Go to CRM-NG SMTP → Tools → Scheduled Actions. The table lists tasks with their status: Pending, In-progress, Complete, Failed or Canceled, and when each is due.
Action Scheduler is shared with other plugins, such as WooCommerce. You may see tasks that have nothing to do with CRM-NG SMTP. Search for crmng_smtp to show only ours.
How tasks get run
Action Scheduler is triggered by WP-Cron, WordPress's built-in scheduler. WP-Cron does not run on a clock: it runs when someone visits the site. On a quiet site, or a site where WP-Cron is switched off, tasks wait until the next trigger.
Problem: past-due actions
You see pending tasks whose due time has passed, sometimes with a notice about past-due actions.
- Check for traffic
On a low-traffic site, tasks may simply be waiting for a visit. Load a page on the site and check again after a minute.
- Check whether WP-Cron is disabled
Look in
wp-config.phpfordefine( 'DISABLE_WP_CRON', true );. If it is there, a real server cron job must call WordPress instead (next section). - Check Site Health
Go to Tools → Site Health. WordPress reports if scheduled events are failing or late, and if background requests to your own site (loopback requests) are blocked.
- Run the tasks by hand
In Scheduled Actions, hover over a pending task and click Run. If it fails, the log for that task shows why.
Loopback requests are often blocked by a security plugin, a firewall, HTTP authentication on a staging site, or a server that cannot resolve its own domain. Your host can help with the last two.
Problem: WP-Cron is disabled
Many hosts and performance guides recommend DISABLE_WP_CRON and a real cron job instead. That is fine, as long as the cron job exists. Ask your host, or add one in your control panel's Cron Jobs page, to run every five minutes. Either of these works:
*/5 * * * * wget -q -O - "https://yourdomain.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
*/5 * * * * cd /path/to/wordpress && wp cron event run --due-now >/dev/null 2>&1
To clear a backlog straight away with WP-CLI:
wp action-scheduler run --group=crmng_smtp
Problem: a very large queue
Signs: the Scheduled Actions page loads slowly, or shows tens of thousands of entries.
- Completed and canceled tasks are cleared automatically after a retention period (about a month by default). A large number of them is normal on a busy site and not a problem in itself.
- Many pending queued-email tasks mean emails are arriving faster than they can be sent. Check your Email Rate Limiting values are not set too low for your normal volume, and that your mail service is not refusing messages (see Debug events).
- Many failed tasks point to a real error. Open one and read its log.
- Tasks from other plugins can swamp the table. That is up to those plugins, but it slows everything that uses Action Scheduler, including ours.
Problem: tasks fail with a database error
If tasks fail with errors about missing tables, check Tools → Site Health for "CRM-NG SMTP DB tables check has failed" and use its link to create the missing tables. See Site Health checks.
When to turn the queue off
If you cannot get background tasks running reliably on your host, turn off Optimize Email Sending on the Misc tab. Emails are then sent immediately while the page loads, which does not depend on background tasks. See Miscellaneous settings.
