Background jobs are late or stuck
Notifications, emails, live updates, search and much more are background jobs. When they wait too long, the community feels slow to tell anyone anything. Poly Community → Settings → Advanced → Background jobs says what is going on, and Tools → Site Health has a check of its own, Community background jobs are running.
Jobs wait longer than they should
The card says "Jobs are waiting longer than they should" when the oldest job of a queue waited past its time.
- A quiet site. Without a system cron, jobs run after a page is served, and WP-Cron runs only when someone visits. On a site with few visitors, jobs wait for the next one. Add the System cron line, as its card shows it, to the crontab of your server or the cron jobs screen of your host.
- WP-Cron turned off. The card says so when
wp-config.phpturns it off. Then a system cron is needed. - No PHP-FPM or LiteSpeed. After the response says it is not available, and a background request is used instead. Some hosts block the site calling itself. A system cron makes it work either way.
Run jobs now runs what is due at once, to see whether jobs run at all.
A job failed
A job is tried again a few times, waiting longer each time. One that failed every time stops, and is listed under Failed jobs with what went wrong. Fix the cause, then Retry it, or Retry all:
- a service that refused, such as email delivery or storage: see its screen under Settings → Services
- a file the server could not write: the uploads folder must be writable
- a timeout: a long job on a slow host, which a system cron gives more time
Failed jobs are deleted after 30 days.
The database came back from a copy
When the database of a staging copy is put on the live site, the card says "The database came back from" with the address of the copy. The jobs the copy had set aside that were due already are dropped, as this site ran them meanwhile, so nothing is sent twice. The rest run at their time, and each recurring job starts again from now.
From the command line
wp poly-community queue work
runs the jobs for up to 55 seconds in a terminal, where an error shows that a page would hide.