[wp-hackers] WP cron and "multi-threading"

Peter Westwood peter.westwood at ftwr.co.uk
Mon Oct 9 17:24:01 GMT 2006

Hash: SHA1

Mark Jaquith wrote:
> On Oct 9, 2006, at 12:14 AM, Robert Deaton wrote:
>>> Mark Jaquith wrote:
>>> > You need to expire the "cron_is_running" option, in case your winning
>>> > race candidate dies before it gets to unset it.
>> No, if it loses the race condition, something else has overwritten it.
>> The other thread that won the race condition will clean it up when its
>> finished.
> It'll clean up *IF* it finishes.  What if one of the cron'd actions
> causes a fatal error?  Then you're stuck with "cron_is_running" set to a
> key that'll never be matched again.
> Pretend that Tom Hanks is a process.  He claims Helen Hunt by marrying
> her.  Then, his FedEx plane crashes and he's stranded on a tropical
> island with only an inflatable ball as a companion.  Helen Hunt is
> stuck, because she can't confirm that Hanks has died or otherwise
> *explicitly* relinquished his claim on her as his spouse.  Should she
> wait forever?  Nah.  She waits a few years and Hanks is declared legally
> dead, and she remarries.
> Sort of like that. :-)

How about this.

Kind of like the approach I take in my sk2-digest-plugin to stop getting
multiple digest emails with concurrent spam attempts.

1. Cron event is detected to be run
2. Reschedule event for now+10mins
3. Run event
4. Unschedule the now+10mins event

i.e some way of marking an event as in progress but ensuring that if
something die()'s we give the event another chance.

- --
Peter Westwood
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the wp-hackers mailing list