Skip to content

Commit

Permalink
Merge pull request #1825 from wp-media/fix/1645-preload-count
Browse files Browse the repository at this point in the history
Fixes #1645 Increase the counter even if the page is already cached
  • Loading branch information
Screenfeed committed Jul 8, 2019
2 parents cbd37c5 + 2f6dd57 commit 0d13878
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inc/classes/preload/class-full-process.php
Expand Up @@ -42,6 +42,9 @@ class Full_Process extends \WP_Background_Process {
* @return null
*/
protected function task( $item ) {
$count = get_transient( 'rocket_preload_running' );
set_transient( 'rocket_preload_running', $count + 1 );

if ( $this->is_already_cached( $item ) ) {
return false;
}
Expand All @@ -63,9 +66,6 @@ protected function task( $item ) {

wp_remote_get( esc_url_raw( $item ), $args );

$count = get_transient( 'rocket_preload_running' );
set_transient( 'rocket_preload_running', $count + 1 );

usleep( absint( get_rocket_option( 'sitemap_preload_url_crawl', 500000 ) ) );

return false;
Expand Down

0 comments on commit 0d13878

Please sign in to comment.