Making WordPress.org

Changeset 5233


Ignore:
Timestamp:
04/04/2017 04:59:12 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: SVN Watcher: Wait for 2 consequtive SVN failures to occur before throwing exceptions - a single network timeout is usually transitive.
This also switches cron tasks to be checked for / registered on init, to ensure that a failed recurring task (one which throws an exception) is re-registered in Cavalcade.

Fixes #2678

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php

    r4520 r5233  
    7070        $logs = SVN::log( self::SVN_URL, array( $rev, $head_rev ) );
    7171        if ( $logs['errors'] ) {
    72             throw new Exception( "Could not fetch plugins.svn logs: " . implode( ', ', $logs['errors'] ) );
     72            if ( wp_cache_get( 'get_plugin_changes_between_failed', 'svn-watch' ) ) {
     73                // Set it again, so if the next request fails, this exception will be thrown again, until the issue is resolved.
     74                wp_cache_set( 'get_plugin_changes_between_failed', time(), 'svn-watch', 60 );
     75
     76                throw new Exception( "Could not fetch plugins.svn logs: " . implode( ', ', $logs['errors'] ) );
     77            } else {
     78                // If the job fails again within the next minute, throw an exception (as above)
     79                // but for now, just silently let it re-try next iteration, hopefully it was a transient failure / network timeout.
     80                wp_cache_set( 'get_plugin_changes_between_failed', time(), 'svn-watch', 60 );
     81                return array();
     82            }
    7383        }
    7484
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php

    r4727 r5233  
    1111
    1212    /**
    13      * A static method for the cron trigger to fire.
     13     * Add all the actions for cron tasks and schedules.
    1414     */
    1515    public function __construct() {
    1616        // Register all the cron task handlers.
    17         add_action( 'admin_init', array( $this, 'register_cron_tasks' ) );
     17        add_action( 'init', array( $this, 'register_cron_tasks' ) );
    1818        add_filter( 'cron_schedules', array( $this, 'register_schedules' ) );
    1919
Note: See TracChangeset for help on using the changeset viewer.