Skip to content

Commit

Permalink
Stop retrying when rss news feed does not respond
Browse files Browse the repository at this point in the history
The rss feed at https://www.phplist.org/newslist/feed/ is still unreliable. Currently the code caches the feed content in the php session, but when the feed is not responding then each page load is affected by having to keep retrying.

This change simply caches empty strings when the feed does not respond. The feed won't be tried again until the admin logs-out, therefore all subsequent pages will not display the news sidebar.
  • Loading branch information
bramley committed Oct 26, 2016
1 parent a82bde2 commit 01be374
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rssfeed.php
Expand Up @@ -84,5 +84,8 @@ function buildNews($rss, $max)
if ($parseresult) {
$_SESSION['news']['short'] = buildNews($rss, 3);
$_SESSION['news']['long'] = buildNews($rss, 10);
echo $_SESSION['news'][$newsSize];
} else {
$_SESSION['news']['short'] = '';
$_SESSION['news']['long'] = '';
}
echo $_SESSION['news'][$newsSize];

0 comments on commit 01be374

Please sign in to comment.