[wp-hackers] Hooking into wp-cron settings?

Chip Bennett chip at chipbennett.net
Mon Dec 13 16:12:34 UTC 2010


On Mon, Dec 13, 2010 at 10:02 AM, Andrew Nacin <wp at andrewnacin.com> wrote:

> On Mon, Dec 13, 2010 at 10:46 AM, Chip Bennett <chip at chipbennett.net>
> wrote:
> >
> >  > You can add a filter on http_request_args and modify the timeout there
> > > if doing cron. e.g. (completely untested)
> > >
> > > function my_cron_http_request_args($r) {
> > >     if (defined('DOING_CRON') && DOING_CRON) {
> > >          $r['timeout'] = 5;
> > >     }
> > >     return $r;
> > > }
> > > add_filter('http_request_args', 'my_cron_http_request_args');
> >
>
> You're trying to change the timeout for the spawn, not wp-cron, so
> DOING_CRON won't be defined.
>
> http_request_args passes a second arg, $url. You'll want to set timeout to
> 5
> when $url = get_option('siteurl') . '/wp-cron.php'.
>

get_option( 'siteurl' ) => would site_url() work/not work/be more
appropriate?

>
> I wouldn't call that a recommended fix. Five seconds is a long time to wait
> for the user who gets caught with that.


Right now, it would be a temporary fix. Clearly, something is interfering
with the cron job firing/completing, and I need to figure out what it is.
I'm still looking into that (though I've seen some forum posts that suggest
that certain Plugins, including caching Plugins, may somehow be
contributing).


> 0.01 should work under any transport
> we support currently (exception, WP 2.9.0, fixed in WP 2.9.1), though I'd
> either use the alternate cron, or by firing wp-cron at the system level.
>

Care to point me in the right direction for learning how to use the
alternate cron and firign wp-cron at the system level?

Thanks!

Chip


More information about the wp-hackers mailing list