Cron jobs taking too long

Recommended Posts

Magento 2.2.7

Ess M2ePro 1.3.5

I've been noticing that my cron jobs on Magento are taking a long time to complete. I run the job using an HTTP get request to https://<server>/pub/cron.php every minute.

See the screenshot for timings for the M2ePro module.

My store only has 80 items listed and only perhaps 10-20 sales per day, so can't see why it should be taking so long. Anyone seeing anything similar before I dive into a deep debug.



Screenshot (23).png

Share this post

Link to post
Share on other sites

OK, tracked this down eventually, and it is by design.

The M2ePro cron module tries to be clever and applies a random delay to the start of the cron jobs in an attempt to distribute load on a server.

It only does this load distribution under certain conditions.

If you are in developer mode, it does not distribute load.

If the php max_execution_time setting is under 300 seconds it does not distribute load.

To distribute load, each cron job is delayed by a random delay anywhere between 0 and 60 seconds.

This is pretty poor in my opinion. What happens if the cron job is deleyed by 59 seconds. It will most likely still be running when the next cron initiation is attempted resulting in skipped crons.

Time for a module override me thinks to get rid of this pesky load distribution. This should really be a setting that we can turn on/off.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.