9

Synopsis

So I wanted to confirm my understanding of the cron configurations with Magento; under the admin console System > Configuration > Advanced > System > Cron:

Generate Schedules Every #

I am unsure as to what this setting is about.

Schedule Ahead for #

I am assuming this will schedule # minutes ahead of crons. If the cron scheduler is configured in the cron tab to run every 5 minutes should this number also be configured to 5 or would Magento not reschedule jobs already scheduled?

Missed if Not Run Within #

This appears to me as if to say when a cron is scheduled to run and is not executed within # minutes it is set as 'missed'.

History Cleanup Every #

I imagine this should run through the cron_Schedule table and clear out all missed and executed schedules # minutes after they were executed/missed?

Success History Lifetime #

In regards to the previous configuration I assume this is going to clear out all successful schedules after # minutes?

Failure History Lifetime #

I assume this would clear out all missed schedules after # minutes? and then the history cleanup every #, success history and failure history settings are all entirely ambiguous.

7

The thing that is confusing about Magento’s cron services is that, while they do get invoked by the system cron, they are abstracted another level above it in a event/observer model that is common throughout Magento.

Once you understand this, the settings make more sense. If you want to see what they do exactly, their usage is pretty clear in app/code/core/Mage/Cron/Model/Observer.php, which is the observer that gets triggered for the default event in the crontab scope and in turn dispatches all the scheduled jobs.

  • Generate Schedules Every: minutes interval for when Magento will schedule future jobs. It does not automatically schedule jobs during every execution.
  • Schedule Ahead for: minutes in the future that jobs can be scheduled (added to cron_schedule database queue).
  • Missed if Not Run Within: minutes past their scheduled time that jobs can still be executed before having their status set as missed, which comes into play if the queue is taking a long time to get through all the jobs that have been selected to run during the current execution of Mage_Cron_Model_Observer::dispatch() (their scheduled time is now or earlier).
  • History Cleanup Every: minutes interval for when Magento will perform cleanup on the cron_schedule database queue, making reference to settings below regarding retention.
  • Success History Lifetime & Failure History Lifetime: minutes in the future to leave records in the queue after they have reached these statuses. This comes into play if you want to see the result of past jobs since they may have placed resulting output into cron_schedule.messages, which can be especially helpful in the case of error status.
  • why if a change ahead_for_scehdule from 1 to 10, no more schedule are added to crontab? – LucScu Sep 18 '17 at 10:42
  • Defaults are: schedule_generate_every 15 schedule_ahead_for 20 schedule_lifetime 15 history_cleanup_every 10 history_success_lifetime 60 history_failure_lifetime 600 – Collin Anderson Oct 19 '17 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.