[wp-hackers] Can Multiple Simultaneous Cron Instances Be Called ?

Otto otto at ottodestruct.com
Tue Dec 7 06:19:48 UTC 2010


On Mon, Dec 6, 2010 at 10:49 PM, Casey Bisson <casey.bisson at gmail.com> wrote:
>
> I struggled with simultaneous execution problems a bit. One solution, I believe, is to use actual unix cron to trigger wp cron, but I turned to mysql named locks. They're quicker to set than a table update and automatically reset after the connection that created them is dropped.
>
> Usage example in one of my plugins here:
>
> http://plugins.trac.wordpress.org/browser/bsuite/trunk/bsuite.php#L2276

Be careful with that. MySQL locks are held on a *server* basis, not a
database one. So if you happen to share the same server as other
installations, they can block you if the locks have the same name.

Best to use the DB name in the lock name to prevent this sort of thing.

-Otto


More information about the wp-hackers mailing list