Forums

fetch_rss times out too quickly (8 posts)

  1. fiddyp
    Member
    Posted 4 years ago #

    i'm using fetch_rss() in one of my plugins and it works ok but not with feeds that take a little longer than normal to load.

    is there any way to increase the timeout figure from the 5 seconds currently used to 10 seconds without installing magpie?

  2. Otto
    Tech Ninja
    Posted 4 years ago #

    Actually, it's a 2 second timeout.

    Add this to your wp-config.php file:
    define('MAGPIE_FETCH_TIME_OUT', 2);

    Adjust the number as you see fit.

  3. teamplaylotto
    Member
    Posted 4 years ago #

    thanks Otto!
    that worked a treat, now how would I implement that in the plugin so that a user of the plugin wouldn't have to actually edit their own config file?

  4. Otto
    Tech Ninja
    Posted 4 years ago #

    Just put it in the plugin instead of wp-config.php. The plugins load before the rss functions do.

  5. teamplaylotto
    Member
    Posted 4 years ago #

    otto, thank you so much!

  6. daviding
    Member
    Posted 4 years ago #

    I was having a problem with feeds from one blog not showing up on another block (which I diagnosed as a rss_fetch error), that remained a mystery.

    I've now upgraded WordPress from v2.2.1 to v2.3.2, and happened to find this thread. I suspect that my problem is a timeout error, and am experimenting. I've added define('MAGPIE_FETCH_TIME_OUT', 5); to wp-config.php .

    I had written a branch, i.e. on http://daviding.com/blog , `<h2>Recently on coevolving.com</h2>

    <?php require_once(ABSPATH . WPINC . '/rss.php'); ?>

    <?php $rss = fetch_rss('http://coevolving.com/blogs/index.php/feed/'); ?>

    `

    ... and now you can see the page load hang as it tries to access the other feed.

    It's still a mystery to me! I had thought that Magpie does some caching, so I'll leave this change in place for a little while, to see if it shakes itself out.

  7. rajdash
    Member
    Posted 4 years ago #

    I tried the define code (and triple-checked syntax) and I get an error that wp-blog-header.php has undefined functions (directly below the line where it imports wp-config.php). No matter whether I copy and paste from here or manually type in the line of code, it simply won't work.

  8. daviding
    Member
    Posted 4 years ago #

    Looking at the code again, I've noticed that ...

    <?php require_once(ABSPATH . WPINC . '/rss.php'); ?>

    ... reads on the codex as ...
    <?php include_once(ABSPATH . WPINC . '/rss.php'); ?>

    I'm not a real WordPress expert, so I'm not sure what the difference between the require_once and include_once is ... but it seems to have solved my problem -- at least in one direction of feeding the blog to the other.

Topic Closed

This topic has been closed to new replies.

About this Topic