Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WordPress] Limit feed to 20 items #1801

Merged
merged 3 commits into from
Oct 21, 2020
Merged

[WordPress] Limit feed to 20 items #1801

merged 3 commits into from
Oct 21, 2020

Conversation

ORelio
Copy link
Contributor

@ORelio ORelio commented Oct 15, 2020

I encountered a WordPress site having all its articles from the beginning in its feed, which meant hundreds of entries.
Fetching all the articles is time consuming, so the feed failed to load in RSS-Bridge because of a script timeout.
This PR adds a limit of 20 items in WordPress bridge to keep load times reasonable and avoid hammering the target site.
Extra items are kept unexpanded so they will still be present in the feed.

Very large feeds will fail to load otherwise
Copy link
Contributor

@em92 em92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @ORelio! I suggest to discard those 20+ items instead of leaving unexpanded. In feed readers like Tiny Tiny RSS old items will be rewrited to unexpanded, if we leave like this.

Very large feeds will fail to load otherwise
@ORelio
Copy link
Contributor Author

ORelio commented Oct 19, 2020

Sure, done. Now the feed is truncated to 20 items.

@ORelio ORelio requested a review from em92 October 19, 2020 19:26
Copy link
Contributor

@VerifiedJoseph VerifiedJoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use collectExpandableDatas() to limit number of items returned, its simpler than your current method.

try{
	$this->collectExpandableDatas($this->getURI() . '/feed/atom/', 20);
} catch (Exception $e) {
	$this->collectExpandableDatas($this->getURI() . '/?feed=atom', 20);
}

@ORelio
Copy link
Contributor Author

ORelio commented Oct 20, 2020

Oh nice, thanks @VerifiedJoseph for the tip! Done.

@ORelio ORelio changed the title [WordPress] Limit expanding to 20 items [WordPress] Limit feed to 20 items Oct 20, 2020
@em92 em92 merged commit 2714c3d into RSS-Bridge:master Oct 21, 2020
@em92
Copy link
Contributor

em92 commented Oct 21, 2020

Thanks @ORelio and @VerifiedJoseph !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants