rss MDL-25319 adding a check to avoid some work if the same rss feed is requested repeatedly

This commit is contained in:
Andrew Davis 2010-11-19 06:33:38 +00:00
parent bb7603e900
commit da8ae44ead

View file

@ -79,7 +79,9 @@ function forum_rss_get_feed($context, $args) {
if (file_exists($cachedfilepath)) {
$cachedfilelastmodified = filemtime($cachedfilepath);
}
if (forum_rss_newstuff($forum, $cm, $cachedfilelastmodified)) {
//if the cache is more than 60 seconds old and there's new stuff
$dontrecheckcutoff = time()-60;
if ( $dontrecheckcutoff > $cachedfilelastmodified && forum_rss_newstuff($forum, $cm, $cachedfilelastmodified)) {
//need to regenerate the cached version
$result = forum_rss_feed_contents($forum, $sql);
if (!empty($result)) {