]> git.wh0rd.org - tt-rss.git/commitdiff
update_rss_feed: limit maximum execution time while processing articles
authorAndrew Dolgov <noreply@fakecake.org>
Wed, 17 Jun 2015 20:25:21 +0000 (23:25 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Wed, 17 Jun 2015 20:26:09 +0000 (23:26 +0300)
include/rssfuncs.php

index dcf86c1af65ef708c100e9ea5b738ceb2c38b27f..4efc843c43180ce53854533b140a0f6604edc7e7 100644 (file)
 
                        _debug("processing articles...", $debug_enabled);
 
+                       $tstart = time();
+
                        foreach ($items as $item) {
                                if ($_REQUEST['xdebug'] == 3) {
                                        print_r($item);
                                }
 
+                               if (ini_get("max_execution_time") > 0 && time() - $tstart >= ini_get("max_execution_time") * 0.7) {
+                                       _debug("looks like there's too many articles to process at once, breaking out", $debug_enabled);
+                                       break;
+                               }
+
                                $entry_guid = $item->get_id();
                                if (!$entry_guid) $entry_guid = $item->get_link();
                                if (!$entry_guid) $entry_guid = make_guid_from_title($item->get_title());