Changeset 8919
- Timestamp:
- 06/05/2019 04:52:17 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/site-search/jetpack-search.php
r8904 r8919 226 226 $cache_key = md5( $json_es_args ); 227 227 $lock_key = 'lock-' . $cache_key; 228 $count_key = 'count-' . $cache_key;229 228 230 229 // If the Query args were not able to be encoded, bail. … … 247 246 248 247 if ( $do_fresh_request ) { 249 // Keep track of the number of concurrent requests for this key250 wp_cache_set( $count_key, 1, self::CACHE_GROUP, 60 );251 248 252 249 // If the error volume is high, there's a proportionally lower chance that we'll actually attempt to hit the API. … … 276 273 $this->search_error( 'http error ' . $request->get_error_message(), E_USER_WARNING ); 277 274 } else { 278 $this->search_error( 'http status ' . wp_remote_retrieve_response_code( $request ), E_USER_WARNING ); 275 $es_error = json_decode( wp_remote_retrieve_body( $request ), true ); 276 277 $this->search_error( 278 sprintf( 'http status %d %s %s', 279 wp_remote_retrieve_response_code( $request ), 280 $es_error['error'] ?? '', 281 $es_error['message'] ?? '' 282 ), 283 E_USER_WARNING 284 ); 279 285 } 280 286 … … 314 320 // Stampede protection has kicked in, AND we have no stale cached value to display. That's bad - possibly indicates cache exhaustion 315 321 if ( false === $response ) { 316 // Keep a track of how many cache stampede's happen per minute. 317 wp_cache_incr( 'search-stampede-failures', 1, self::CACHE_GROUP ) || wp_cache_set( 'search-stampede-failures', 1, self::CACHE_GROUP, 60 ); 318 319 // Include the number of times this branch has been hit 320 $request_count = wp_cache_incr( $count_key, 1, self::CACHE_GROUP ); 321 trigger_error( 'Plugin directory search: no cached results available during stampede. Requests: ' . $request_count, E_USER_WARNING ); 322 trigger_error( 'Plugin directory search: no cached results available during stampede.', E_USER_WARNING ); 322 323 } 323 324 }
Note: See TracChangeset
for help on using the changeset viewer.