[wp-trac] [WordPress Trac] #6966: cron: prevent duplicate events
WordPress Trac
wp-trac at lists.automattic.com
Tue May 13 02:41:16 GMT 2008
#6966: cron: prevent duplicate events
------------------------+---------------------------------------------------
Reporter: tellyworth | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
------------------------+---------------------------------------------------
This is an unusual case but worth defending against:
If a user submits many posts in a short period of time (perhaps with XML-
RPC), the cron array can fill up with a backlog of do_pings events. Since
do_pings operates on all posts, there's no reason to have more than one of
these events scheduled.
The enclosed patch changes wp_schedule_single_event() to ignore new events
if there is already an identical event scheduled within 10 minutes of the
new one. (It also handles the case where there's a backlog of events with
timestamps in the past). The hook and args must be identical for it to be
skipped. 10 minutes is arbitrary but seems reasonable; it could be an
external define if there's a need to change it.
--
Ticket URL: <http://trac.wordpress.org/ticket/6966>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list