]> git.wh0rd.org - tt-rss.git/commitdiff
simplepie: fix feed-not-found bug; update daemon1 to some code from daemon2
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 25 Jan 2008 03:28:14 +0000 (04:28 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 25 Jan 2008 03:28:14 +0000 (04:28 +0100)
functions.php
simplepie/simplepie.inc
update_daemon_loop.php

index cea42549d0013e8737b417c32bc033f717a30be3..d4f7cce993f3380a6759b9ec19f45c88a6135bb9 100644 (file)
 
                        $rss = new SimplePie();
                        $rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT);
-                       $rss->set_timeout(20);
+                       $rss->set_timeout(10);
                        $rss->set_feed_url($fetch_url);
                        $rss->set_output_encoding('UTF-8');
 
index fce53d396fce8cc1a524033d0d5c74f428c05ad3..a90b9ce0e7816e073de5e8bfb1d1239ba9522813 100644 (file)
@@ -7616,6 +7616,11 @@ class SimplePie_File
                                                        return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
                                                }
                                        }
+                                       // No feed fount at error correction.
+                                       // according to http://simplepie.org/support/viewtopic.php?id=1430
+                                       else {
+                                               $this->success = false;
+                                       }
                                }
                        }
                        else
index 4c13dedce512cc2e1119c153d11d8a0164841c4c..320bec414437f92410003aeda8d321eab5ad1057 100644 (file)
        $user_prefs_cache = array();
 
        _debug(sprintf("Scheduled %d feeds to update...\n", db_num_rows($result)));
-       
+
+       // Here is a little cache magic in order to minimize risk of double feed updates.
+       $feeds_to_update = array();
        while ($line = db_fetch_assoc($result)) {
+               $feeds_to_update[$line['id']] = $line;
+       }
+
+       // We update the feed last update started date before anything else.
+       // There is no lag due to feed contents downloads
+       // It prevent an other process to update the same feed (for exemple, forced update by user).
+       $feed_ids = array_keys($feeds_to_update);
+       if($feed_ids) {
+               db_query($link, sprintf("UPDATE ttrss_feeds SET last_update_started = NOW()
+               WHERE id IN (%s)", implode(',', $feed_ids)));
+       }
+
+       while ($line = array_pop($feeds_to_update)) {
 
                _debug("Feed: " . $line["feed_url"] . ", " . $line["last_updated"]);