WordPress.org

Ready to get started?Download WordPress

Forums

SendPress Newsletters
[resolved] SendPress adds new wp-cron entry without limit or sanity (3 posts)

  1. octareenroon91
    Member
    Posted 1 year ago #

    I observed this plugin add one wp-cron entry each time the page loaded, easily going over 1000, all scheduled to go off every hour.

    Looking at the code, we see this
    http://plugins.svn.wordpress.org/sendpress/tags/0.8.7/sendpress.php

    function &init() {
    		static $instance = array();
    		if ( !$instance ) {
    /* trimmed for brevity */
    wp_schedule_event( time(), 'hourly', 'sendpress_cron_action_run' );
    /* trimmed for brevity */
    		}
    		return $instance[0];
    	}

    I suggest adding sanity as described right here in the WordPress documentation.
    http://codex.wordpress.org/Function_Reference/wp_schedule_event#A_simple_way_to_schedule_an_hourly_event

    Basically, the wp_schedule_event() call needs to be guaranteed to only run if there is no event already scheduled.
    if ( !wp_next_scheduled( 'sendpress_cron_action_run' ) ) { /* */ }

    Maybe WP previously corrected this misbehavior automatically, but if so, no more!

    http://wordpress.org/extend/plugins/sendpress/

  2. Josh Lyford
    Member
    Plugin Author

    Posted 1 year ago #

    Hi octareenroon91,

    Your right about the cron. Thanks for letting us know. We will have a fix out for it shortly.

  3. Josh Lyford
    Member
    Plugin Author

    Posted 1 year ago #

    This was fixed with 0.8.7.1

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic