• Resolved Jon Fuller

    (@garconis)


    We are using WP Crontrol to create 2 custom PHP Crons for use with WP All Export. This has been set up and working for a couple years.

    We have a processing cron, and a trigger cron.

    The trigger cron is set up to run every hours. This one works fine and never deletes itself.

    The processing cron is set up to run every 2 minutes. This is the one that will occasionally get deleted somehow.

    That particular cron is a PHP Cron Event and similar to the following:

    PHP CODE:
    wp_remote_get("https://example.com/wp-load.php?export_key=J84Aihy5z3jAp&export_id=3&action=processing");

    EVENT NAME:
    GUPI Pit Crew Users Export - Processing

    RECURRENCE:
    Every 2 Minutes (2 minutes)

    Back in November 2019 is when I first started to notice this particular PHP Cron Event was being removed somehow. I checked it on 11/27/2019 and that PHP Cron Event wasn’t in the list. When I checked the corresponding WP All Export setup, it says it hadn’t been ran for 4 weeks. That means the actual PHP Cron Event was somehow deleted 4 weeks prior.

    Since then, I’ve been checking this PHP Cron Event on a monthly basis, to ensure it’s still present within the setup. But it does seem to keep deleting itself. Almost on a monthly basis. I checked in Mid February, and it has been gone for about 3 weeks. I then checked today, and it had been gone for about 2 weeks.

    I re-add the PHP Cron Event each time, but I’m not sure what causes it to run fine for a few weeks, then somehow randomly gets removed/deleted.

    It’s causing our WP All Export task to not run. 🙁

    Worth mentioning, we have another website just like this one, and it has the same type of PHP Cron Events set up for the same purposes. One is Every 2 Minutes and one is Once Hourly. This other website never has an issue with any PHP Cron Event being deleted. But the other website (as being discussed here) is seemingly the only one that is deleting its Every 2 Minutes cron event.

    Any ideas?

Viewing 1 replies (of 1 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I’ve seen issues in the past with cron events with recurrences that are shorter than the time it takes to run the event. If the cron event itself takes more than two minutes (eg. it’s a slow process or there’s a sporadic network timeout), then I think the behaviour might be indeterminate and the event might not get re-added.

    Personally I would recommend switching to a task runner such as Action Scheduler (which is used by WooCommerce) for a task such as this.

Viewing 1 replies (of 1 total)

The topic ‘Custom PHP Cron keeps deleting itself?’ is closed to new replies.