diff options
author | Andrew Dolgov <[email protected]> | 2015-06-17 23:25:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-06-17 23:26:09 +0300 |
commit | 6c9f3d4a6002e23d15e4d518cd0ed5aea25229bd (patch) | |
tree | 9662f6ac3465dd0e2f6a1313372d0ed96e879571 | |
parent | fe4535e6d3aa57d0b26adfe143aface8763ebc22 (diff) |
update_rss_feed: limit maximum execution time while processing articles
-rw-r--r-- | include/rssfuncs.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php index dcf86c1af..4efc843c4 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -588,11 +588,18 @@ _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()); |