Changeset 5235
- Timestamp:
- 04/04/2017 06:02:37 AM (8 years ago)
- 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
r5234 r5235 73 73 // Set it again, so if the next request fails, this exception will be thrown again, until the issue is resolved. 74 74 wp_cache_set( 'get_plugin_changes_between_failed', time(), 'svn-watch', 60 ); 75 76 // Check the status of the cronjobs are sane, as the exception will trigger it to be marked as `failed`. 77 wp_schedule_single_event( time() + 30, 'plugin_directory_check_cronjobs' ); 75 78 76 79 throw new Exception( "Could not fetch plugins.svn logs: " . implode( ', ', $logs['errors'] ) ); … … 162 165 $log = SVN::log( self::SVN_URL, 'HEAD' ); 163 166 if ( $log['errors'] || ! $log['log'] ) { 167 // Check the status of the cronjobs are sane, as the exception will trigger it to be marked as `failed`. 168 wp_schedule_single_event( time() + 30, 'plugin_directory_check_cronjobs' ); 169 164 170 throw new Exception( "Unable to determine HEAD revision" ); 165 171 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php
r5233 r5235 15 15 public function __construct() { 16 16 // Register all the cron task handlers. 17 add_action( ' init', array( $this, 'register_cron_tasks' ) );17 add_action( 'admin_init', array( $this, 'register_cron_tasks' ) ); 18 18 add_filter( 'cron_schedules', array( $this, 'register_schedules' ) ); 19 19 … … 22 22 add_action( 'plugin_directory_svn_sync', array( __NAMESPACE__ . '\SVN_Watcher', 'cron_trigger' ) ); 23 23 add_action( 'plugin_directory_update_api_check', array( __NAMESPACE__ . '\API_Update_Updater', 'cron_trigger' ) ); 24 25 // A cronjob to check cronjobs 26 add_action( 'plugin_directory_check_cronjobs', array( $this, 'register_cron_tasks' ) ); 24 27 25 28 // Register the wildcard cron hook tasks. … … 35 38 public function register_schedules( $schedules ) { 36 39 $schedules['every_30s'] = array( 'interval' => 30, 'display' => 'Every 30 seconds' ); 40 $schedules['every_120s'] = array( 'interval' => 120, 'display' => 'Every 120 seconds' ); 37 41 38 42 return $schedules; … … 126 130 /** 127 131 * Queue all of our cron tasks. 132 * 133 * The jobs are queued for 1 minutes time to avoid recurring job failures from repeating too soon. 128 134 */ 129 function register_cron_tasks() {135 public function register_cron_tasks() { 130 136 if ( ! wp_next_scheduled ( 'plugin_directory_meta_sync' ) ) { 131 wp_schedule_event( time() , 'hourly', 'plugin_directory_meta_sync' );137 wp_schedule_event( time() + 60, 'hourly', 'plugin_directory_meta_sync' ); 132 138 } 133 139 if ( ! wp_next_scheduled ( 'plugin_directory_svn_sync' ) ) { 134 wp_schedule_event( time() , 'every_30s', 'plugin_directory_svn_sync' );140 wp_schedule_event( time() + 60, 'every_30s', 'plugin_directory_svn_sync' ); 135 141 } 136 142 if ( ! wp_next_scheduled ( 'plugin_directory_update_api_check' ) ) { 137 wp_schedule_event( time(), 'hourly', 'plugin_directory_update_api_check' ); 143 wp_schedule_event( time() + 60, 'hourly', 'plugin_directory_update_api_check' ); 144 } 145 if ( ! wp_next_scheduled ( 'plugin_directory_check_cronjobs' ) ) { 146 wp_schedule_event( time() + 60, 'every_120s', 'plugin_directory_check_cronjobs' ); 138 147 } 139 148 } … … 149 158 * @return array The Cron array passed, unchanged. 150 159 */ 151 function register_colon_based_hook_handlers( $cron_array ) {160 public function register_colon_based_hook_handlers( $cron_array ) { 152 161 $wildcard_cron_tasks = array( 153 162 'import_plugin' => array( __NAMESPACE__ . '\Plugin_Import', 'cron_trigger' ),
Note: See TracChangeset
for help on using the changeset viewer.