WordPress.org

Ready to get started?Download WordPress

Forums

Problems with build in Cronjob Schedule - is this a bug? (2 posts)

  1. Juergen Schulze
    Member
    Posted 3 years ago #

    I have programmed a pluging (Emu2 - Email Users 2) to send out mails to users/groups. It's still beta but the main functions work.

    Now I added a feature for a digest of the newest posts to be sent out once a day controlled by the build in scheduler.

    I do the following:

    # plan the scheduler
    add_action('EMU2_task_hook', 'EMU2_send_scheduled');

    where EMU2_send_scheduled is the function sending all the mails. This is working.

    wp_clear_scheduled_hook('EMU2_task_hook');
    wp_schedule_event( strtotime( $schedule_time ) - get_option('gmt_offset') * 3600 , 'daily', 'EMU2_task_hook' );

    Where $schedule_time is set by the user, e.g. "23:15" for mails to be sent at 11:15 pm.

    This works, I checked it with wp-crontrol.

    But now come the problems.

    Some of the users which downloaded my plugin reported strange behaviors with the scheduled mails send out every hour instead of only once a day. Or with mails send three times in a row.

    I first thought they did something wrong. But after a few days of stable work it happened to me as well (Online, less than 10 users, Linux)

    I am using/testing this on 5 installations, online and offline, on different hosts and systems (Windows/xampp and Linux). Some work today, but they fail the next day with sending two or even three mails at once, i.e. starting the job two/three times.

    I have no clue what is going on.

    Is this a bug? Is this caused by interferences with other schedules or plugins?

  2. Miserere
    Member
    Posted 3 years ago #

    I am using this plugin, and after installing the latest version (0.82b) it started sending out digests every hour. I initially thought it was another plugin that was causing the problem and pestered its author for a solution. Eventually, after being directed to check the cron jobs scheduled (through WP-Crontrol) I found the EMU2_task_hook responsible for the digests. I didn't know Email Users 2 had that capability so I never thought of it being the culprit!

    I checked the settings for Email Users 2 and the box for digests is blank, so I don't know why it's sending e-mails out either.

    I killed the cron job and saved the settings again (with an empty digest box) and am now hoping for the best. If it starts doing this again I will have to revert back to the previous version.

    Good luck figuring out what the problem is!

Topic Closed

This topic has been closed to new replies.

About this Topic