WordPress.org

Ready to get started?Download WordPress

Forums

Warm Cache
[resolved] Needs flush to write buffers to prevent timeouts (6 posts)

  1. tflight
    Member
    Posted 11 months ago #

    Many hosts implement timeouts on PHP scripts that don't finish (or have any output) for a certain amount of seconds. See here for a longer writeup of the issue:

    http://donotexec.com/2013/06/cloud-sites-timeout-on-cms-install/

    Because of this, the Warm Cache plugin often doesn't finish its job when it is executed. In my situation I only want it to preload the cache once every three hours. My host limits PHP scripts to 30 seconds (if no output) and with many Pages/Posts it can take four of five runs to get everything preloaded.

    In warm_cache_crawl, around line 68, I added a flush call to the end of the for loop and now the plugin runs fine the first time and no longer times out after 30 seconds.

    for($i = 0;$i < $cnt;$i++){
    				$page = (string)$xml->url[$i]->loc;
    				echo '<br/>Busy with: '.$page;
    				$newvalue['pages'][] = $page;
    				$tmp = wp_remote_get($page);
    				flush(); // prevent timeout from the loadbalancer
    			}

    http://wordpress.org/plugins/warm-cache/

  2. ramon fincken
    Member
    Plugin Author

    Posted 9 months ago #

    Thanks, I will read up on this and implement this feature in a new release!

  3. ramon fincken
    Member
    Plugin Author

    Posted 9 months ago #

    ps: if you have a large site OR a slow server .. you may need to call the plugin more often and make sure your page cache is in order.

  4. ramon fincken
    Member
    Plugin Author

    Posted 4 months ago #

    This will incorporated in the next release.

  5. tflight
    Member
    Posted 4 months ago #

    Great, that change has been working well for me.

  6. ramon fincken
    Member
    Plugin Author

    Posted 4 months ago #

    I've just commited 1.8.1 having your flush command.

Reply

You must log in to post.

About this Plugin

About this Topic