3

Trying to figure out how Magento crons are picking the schedules. Read the magento document page and still not satisfied and thought of asking the question here.

I setup the cron as below

Generate Schedules Every : 15
Schedule Ahead for : 20

The cron.php is running for every 10 minutes. The core frequency for email queue is every 1 minute and I havent override that.

When the cron runs, it created too many schedules for core_email_queue_send_all.

enter image description here

Whant to understand why? What is the logic?

1

because the scheduler creates the entries in advance, you see the difference in the scheduled_at field.

You dont need to care about it, if your cron is configured for every 5 or 10 minutes, this is not a problem. Magento will clean up outdated entries and also the jobs are build in a way, so multiple executions during one run does not lead to problems.

To explain this a bit more, there exists a config value how many minutes ahead the cronjobs should get scheduled. Then it goes trough every minute and creates an entry if the cron expression matches for it. The core_email_queue_send_all has * * * * * as expression, which means every minute.

4
  • The cron works perfect and I dont have problems. Trying to connect the dots how the future schedules are created based on the setting. Does it mean since I have given 20 minutes as ahead it created schedules for every minute for next 20 minutes? – Malaiselvan May 17 '15 at 1:12
  • yes, for every minute matching the cron expression the job uses, and this job has one for every minute. – Flyingmana May 17 '15 at 1:14
  • Thanks. It makes sense to me now. However a small doubt. In my settings the generate schedule runs every 15 minutes but it creates schedules for next 20 minutes... When the next generation runs will there not be duplicate schedules for same time? – Malaiselvan May 17 '15 at 1:52
  • it only generates missing ones, so there should be no duplicates – Flyingmana May 17 '15 at 1:53

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.