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.
Best Answer
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 thedefault
event in thecrontab
scope and in turn dispatches all the scheduled jobs.cron_schedule
database queue).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 ofMage_Cron_Model_Observer::dispatch()
(their scheduled time is now or earlier).cron_schedule
database queue, making reference to settings below regarding retention.cron_schedule.messages
, which can be especially helpful in the case oferror
status.