Support

Home Forums Event Espresso Premium cron directives are getting removed

cron directives are getting removed

Posted: January 13, 2021 at 12:13 pm


ICLE

January 13, 2021 at 12:13 pm

If we are to continue troubleshooting messages we can do that in a new thread as the other is already long and repurposed from an issue with FirstData.

However, I once again logged into the site and checked the cron jobs.

AHEE__EE_Messages_Scheduler__generation
AHEE__EE_Messages_Scheduler__sending

Were missing again but

AHEE__EE_Messages_Scheduler__cleanup

Was still active.


ICLE

January 13, 2021 at 12:45 pm

Why or how can that happen? No one is working on the site.


Tony

  • Support Staff

January 13, 2021 at 4:07 pm

Unfortunately, I can’t tell you why those cron’s are being removed, they are actually managed by WordPress itself and not Event Espresso.

EE activates and calls wp_schedule_event({time}, {frequency}, {hook_name}) to add the scheduled tasks, WordPress than take over and ‘should’ rescheduled the task as it runs, apparently that is failing on your site.

In English, it’s like me saying to you ‘Drink water every 5 minutes until I tell you otherwise’ and then leaving you to manage that yourself. If you stop drinking water I don’t know until we next have a catchup. Same idea here, we tell WordPress to run that cron every 5 mins and somewhere that event is lost and not rescheduled, where/why that happens I can’t tell you as it’s not under EE’s control.

The AHEE__EE_Messages_Scheduler__cleanup runs once daily (think of it as the catchup mentioned above) and within the callback function for that hook we confirm that the other 2 are scheduled, if not we reschedule them. We basically do this as a precaution to try and make sure the message crons are always working.


Tony

  • Support Staff

January 13, 2021 at 4:08 pm

I did log into the site and checked the crons, they are currently showing in the list, although AHEE__EE_Messages_Scheduler__cleanup ran a couple of hours ago now so they may have been missing earlier and once again re-added when that ran.

I’ll check this again when I log in in the morning to see if they are still active.


ICLE

January 14, 2021 at 8:21 am

We found some waiting for generating at 10AM and manually sent them.


Tony

  • Support Staff

January 14, 2021 at 9:31 am

Yeah so your site is randomly dropping the message crons, they aren’t listed now, but will be again in roughly 3 hours when AHEE__EE_Messages_Scheduler__cleanup runs again.

Any errors in the servers error logs overnight? Memory exhausted errors or any fatal errors, do not just look for errors related to Event Espresso as the schedules tasks are not managed by EE.

One thing you can try is increasing the interval time when those crons run using something like this:

https://gist.github.com/Pebblo/ee50c033271de885cd907d189532a513

There are reports elsewhere of 1-minute cron events randomly disappearing:

https://wordpress.stackexchange.com/questions/158303/scheduled-events-disappear-from-events-queue

5 minutes (which we use) is usually fine (although there are some reports of those disappearing as well) but bump it up to 10 and see if it helps.


ICLE

January 14, 2021 at 11:08 am

OK. I will look into the interval times and watch the results and report back.

Here is a response from my server manager:
“We run backups everyday. Midnight and 4 am. One is for Bluehost’s Codeguard Basic and one sent offsite to Google Drive. We do not run any Cron jobs from the server.”


ICLE

January 14, 2021 at 3:02 pm

I two questions:
1) where should this code go? into functions.php?
2) is the following for 1 minute, 100 seconds, etc?
add_filter(‘cron_schedules’, ‘tw_ee_increase_message_cron_interval’, 100);


Tony

  • Support Staff

January 14, 2021 at 3:08 pm

1) where should this code go? into functions.php?

functions.php should work but we usually recommend using a custom functions plugin, you already have multiple instances of those and you don’t need to create another just add the code onto the end of one to those plugins.

2) is the following for 1 minute, 100 seconds, etc?
add_filter(‘cron_schedules’, ‘tw_ee_increase_message_cron_interval’, 100);

Neither, that’s a ‘hook’ call back.

It’s saying “hook into ‘cron_schedules’ and run ‘tw_ee_increase_message_cron_interval’ to do its thing at priority 100”

The code changing the timing of the cron schedule is THIS LINE, setting the interval to 600 seconds (10 Minutes).

For more info on hooks, see:

https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/


ICLE

January 22, 2021 at 1:25 pm

Do you happen to know the times of day the catchup runs?
What is the process to replace the cron definitions that get removed?


Tony

  • Support Staff

January 23, 2021 at 4:40 pm

Do you happen to know the times of day the catchup runs?

It runs once daily but due to the way WP_CRON works it’s not exact (because it relies on users hitting the site).

If you go to Dashboard -> Tools -> Cron Events

Search for ‘AHEE__EE_Messages_Scheduler__cleanup’ and you’ll see when the next runtime is scheduled.

What is the process to replace the cron definitions that get removed?

If AHEE__EE_Messages_Scheduler__cleanup is available above, click run. If the other 2 are not in the list, running it will add them.

If AHEE__EE_Messages_Scheduler__cleanup is not in the list it needs to be added manually and then run.

Click Add new at the top.

Add a standard cron event, hook name is AHEE__EE_Messages_Scheduler__cleanup repeat once daily and add. Then run it.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 2 days, 6 hours ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!