• Resolved sutersoftware

    (@sutersoftware)


    Hi WP Super Cache Support

    As I understand it, the posts should be processed in batches during preloading (WPSC_PRELOAD_POST_COUNT = 10). So to speak batches of 10 by default. Then wait 1 second and do the next batch.

    In wp-cache.php:
    $rows = array_splice( $details, 0, WPSC_PRELOAD_POST_COUNT );
    foreach ( (array) $rows as $url ) {
    sleep( WPSC_PRELOAD_POST_INTERVAL );

    Something doesn’t add up. It only preloads 10 and then the preload stops. I have noticed this particularly with WooCommerce products. It works on some sites but not on others. I could increase the value of WPSC_PRELOAD_POST_COUNT to 1000. But is that really the right thing to do? Or am I misunderstanding something?

    Or does it matter whether I start it manually or run it via the garbage collector/refresh policy?


    Can you take another look at this function in more detail?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter sutersoftware

    (@sutersoftware)

    Nginx caching was enabled in some web hosting services. With high values. That’s why some pages weren’t preloaded even though the files weren’t visible in the web hosting file manager.

    The question with the WPSC_PRELOAD_POST_COUNT is still open. 🙂

    Plugin Support lastsplash (a11n)

    (@lastsplash)

    Hi @sutersoftware

    I’m glad you caught the Nginx issue.

    To look into this, we need a bit more information. Does this happen when you manually run the preload?

    Thread Starter sutersoftware

    (@sutersoftware)

    Hi @lastsplash

    I am not sure. But! I noticed that on some websites, under the text “Refresh preloaded cache files every…” (on the preload tab of the wp super caches settings page) a dropdown menu appears where I can select how many posts should be preloaded.

    I couldn’t figure out when the dropdown appears. I have websites with posts, and it doesn’t appear there. And it appears on others.

    This dropdown did not appear on the websites where the error occurred. Then suddenly it appeared with a small value. So I think the setting changed from a hidden dropdown and a value “all” to a visible dropdown and a small number based value. And that’s why not all pages were preloaded.

    It makes sense that the default value is not set to “all,” especially for websites with 1000+ posts. But what criteria are used to display this dropdown menu? I couldn’t figure that out.

    • This reply was modified 8 months, 3 weeks ago by sutersoftware.
    Plugin Support Animesh Gaurav (a11n)

    (@bizanimesh)

    Hello @sutersoftware – Thanks for sharing all these details. To investigate this and provide you more accurate information, I have started a discussion with our team. We’ll follow up with you as soon as we have an update.

    Internal Reference: p1754906600379829-slack-C016BBAFHHS

    I think I know what’s happening here. The plugin only displays that dropdown if it finds more than 100 posts of post_type “public” or “publicly_queryable”. Here’s the code that counts the posts.

    This isn’t ideal when you’re using different post types and we’ll need to fix it.

    Thread Starter sutersoftware

    (@sutersoftware)

    That is exactly the behavior I have noticed. And that is also the reason why only 10 pages were preloaded . ($step = (int)( $count / 10 );). I didn’t notice that the website had over 100 posts and then this hidden setting came into play.

    Were the majority of those posts of different post types, maybe created by WooCommerce?

    Thread Starter sutersoftware

    (@sutersoftware)

    Mixed. Most of the websites in my customer base only contain posts (the normal blog posts). However, there are also some sites that feature WooCommerce products, events from the Events Calendar plugin or ACF custom posts. Or all of it together.

    With WooCommerce products and events, sites quickly exceed 100 posts. 

    I’m not sure if I have understood you correctly and if this is the answer you need. If not, please ask again. 🙂

    Thread Starter sutersoftware

    (@sutersoftware)

    Small addition: Most of my customer websites are static websites. I have disabled the garbage collector and set the refresh preloaded cache files to 0. I then use a PLESK cron job to start my own PHP script that starts the preload. This means that the supercache is recreated every 12 hours (twice daily). Some websites have so few hits that the pages would not be cached at all.

    Perhaps it would be a great idea to have such an option / function directly in the plugin. Instead of my own homemade solution. (To start the preload from a server-side cron job.) What do you think?

    Happy to share my code.

    Thanks. We’ll have to come up with a different way to get a count of posts possibly, and it would be useful to trigger a preload from a cron job.. One for the todo list.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Preload in batches?’ is closed to new replies.