Changeset 8897
- Timestamp:
- 05/30/2019 07:04:41 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
r6591 r8897 226 226 $cache_key = md5( $json_es_args ); 227 227 $lock_key = 'lock-' . $cache_key; 228 $count_key = 'count-' . $cache_key; 228 229 229 230 $response = wp_cache_get( $cache_key, self::CACHE_GROUP ); … … 232 233 // Other processes will use the stale cached value if it's present, even for a while after the expiration time if a fresh value is still being fetched. 233 234 if ( wp_cache_add( $lock_key, 1, self::CACHE_GROUP, 15 ) ) { 235 // Keep track of the number of concurrent requests for this key 236 wp_cache_set( $count_key, 1, self::CACHE_GROUP, 60 ); 234 237 235 238 // If the error volume is high, there's a proportionally lower chance that we'll actually attempt to hit the API. … … 297 300 // Stampede protection has kicked in, AND we have no stale cached value to display. That's bad - possibly indicates cache exhaustion 298 301 if ( false === $response ) { 299 trigger_error( 'Plugin directory search: no cached results available during stampede.', E_USER_WARNING ); 302 // Keep a track of how many cache stampede's happen per minute. 303 wp_cache_incr( 'search-stampede-failures', 1, self::CACHE_GROUP ) || wp_cache_set( 'search-stampede-failures', 1, self::CACHE_GROUP, 60 ); 304 305 // Include the number of times this branch has been hit 306 $request_count = wp_cache_incr( $count_key, 1, self::CACHE_GROUP ); 307 trigger_error( 'Plugin directory search: no cached results available during stampede. Requests: ' . $request_count, E_USER_WARNING ); 300 308 } 301 309 }
Note: See TracChangeset
for help on using the changeset viewer.