magento2 – How to avoid to have many missed and pending cron jobs?

This is happening for two possible reasons:

  • Low server capacity by the number of cron jobs.
  • Not ideal prioritization.

You can solve that by changing the time that Magento takes to schedule the next job, and increasing the Missed if Not Run Within time, in case it’s an essential CRON job you can add it to a separate process, if it’s not essential you can add many minutes to it.

Magento 2 Cron Scheduled Tasks

Don’t forget to clean up your cache schedule by running these commands below.

n98-magerun2.phar db:query "DELETE from cron_schedule WHERE status='error' OR status='pending' OR status='missed'";
rm -rf var/cron/*
bin/magento cron:run

More details about the Cron (Scheduled Tasks) in the admin panel.