Problems with build in Cronjob Schedule – is this a bug?
-
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?
- The topic ‘Problems with build in Cronjob Schedule – is this a bug?’ is closed to new replies.