diff options
| author | 2020-05-10 21:34:12 +0200 | |
|---|---|---|
| committer | 2020-05-10 21:34:12 +0200 | |
| commit | aea38065901408c8b6d0bb0b619f21fd81fc9347 (patch) | |
| tree | 13ca86572069d9f76d5c7f24777fa61a4a15c8f8 /app/Models/Feed.php | |
| parent | be10486f5e45148c78ab0c0a57a4056d5fc2889a (diff) | |
Attempt to reduce max memory usage during actualize (#2955)
* Attempt to reduce max memory usage during actualize
#Fix https://github.com/FreshRSS/FreshRSS/issues/2952
* Use memory_get_peak_usage
Diffstat (limited to 'app/Models/Feed.php')
| -rw-r--r-- | app/Models/Feed.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 34c036921..1b9bd6f9f 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -333,7 +333,12 @@ class FreshRSS_Feed extends Minz_Model { $guids = array(); $hasUniqueGuids = true; - foreach ($feed->get_items() as $item) { + // We want chronological order and SimplePie uses reverse order. + for ($i = $feed->get_item_quantity() - 1; $i >= 0; $i--) { + $item = $feed->get_item($i); + if ($item == null) { + continue; + } $title = html_only_entity_decode(strip_tags($item->get_title())); $authors = $item->get_authors(); $link = $item->get_permalink(); @@ -414,6 +419,7 @@ class FreshRSS_Feed extends Minz_Model { } $guid = $item->get_id(false, false); + unset($item); $hasUniqueGuids &= empty($guids['_' . $guid]); $guids['_' . $guid] = true; $author_names = ''; @@ -441,7 +447,6 @@ class FreshRSS_Feed extends Minz_Model { } $entries[] = $entry; - unset($item); } $hasBadGuids = $this->attributes('hasBadGuids'); |
