[wp-hackers] wp_schedule_event being triggered multiple times

Callum Macdonald lists.automattic.com at callum-macdonald.com
Tue Feb 27 06:21:44 GMT 2007


Hi Andrew,

The code that deletes the email is in wp-mail.php line 152. If it fails, 
it outputs an error. If you call the wp-mail.php file directly, do you 
see the error message? Perhaps that might shed some light on it...

However, this line only flags the message for deletion, it doesn't 
actually delete it until line 162 when the $pop3->quit() function is 
called. If you're not getting any error messages calling wp-mail.php 
directly you could try adding a print("sporg"); after line 162 to verify 
that it has been executed and doesn't produce a silent error.

Good luck,


Callum.

Andrew Ferguson wrote:
> You were right Callum, the email is not being deleted. Anybody have any
> ideas why?
>
> On 2/26/07, Andrew Ferguson <andrew at fergcorp.com> wrote:
>>
>> I actually took a look at the mySQL entry to see if I could figure out
>> when the emails were being posted. As it turns out, the post does get 
>> it's
>> time stamp from the email.
>>
>> On 2/26/07, Callum Macdonald <lists.automattic.com at callum-macdonald.com>
>> wrote:
>> >
>> > Hey Andrew,
>> >
>> > I'll precede this suggestion by saying I'm not an expert... :)
>> >
>> > Does the post get its timestamp from the date on the email? Could 
>> it be
>> > that the email is being posted multiple times, once per hour, and not
>> > being deleted or not recorded that it has already been posted? If you
>> > check the site just after the hourly cron job, and it's been posted 12
>> > times, then obviously this is not the case!
>> >
>> > Good luck,
>> >
>> >
>> > Callum.
>> >
>> > Andrew Ferguson wrote:
>> > > I'm working on a plugin that uses uses the inbuilt cron system to
>> > > check for
>> > > Blogs by email.
>> > >
>> > > I'm having an issue where emails are posted several times over. For
>> > > example,
>> > > I would send an email to the account specified. The plugin would
>> > > perform its
>> > > hourly check, I would check the site later and I would see multiple
>> > > (somewhere between 1-12) posts of the email, each with same time
>> > > stamp. My
>> > > best guess is that multiple hits are occurring at the moment the
>> > cron'd
>> > > event should be triggered. This causes the the event to execute
>> > multiple
>> > > times before some setting is updated to prevent further 
>> executions for
>> >
>> > > this
>> > > round (i.e. prevent it from executing this hour). Like I said, my 
>> best
>> > > guess.
>> > >
>> > > Here's the code (being released under GPL):
>> > >
>> > > function fergcorp_checkEmailPosts(){
>> > >
>> > >     $handle = fopen(get_bloginfo('wpurl')."/wp-mail.php", "r");
>> > >     fclose($handle);
>> > >
>> > > }
>> > >
>> > > add_action('fergcorp_checkEmailPosts_hook', 
>> 'fergcorp_checkEmailPosts'
>> > );
>> > >
>> > > if (!wp_next_scheduled('fergcorp_checkEmailPosts_hook')) {
>> > >     wp_schedule_event( time(), 'hourly',
>> > > 'fergcorp_checkEmailPosts_hook' );
>> > > }
>> > >
>> > >
>> > > Any ideas?
>> > >
>> > > -Andrew Ferguson
>> > > http://www.andrewferguson.net
>> > > _______________________________________________
>> > > wp-hackers mailing list
>> > > wp-hackers at lists.automattic.com
>> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> > >
>> >
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hackers at lists.automattic.com
>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >
>>
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



More information about the wp-hackers mailing list