redlib-org / redlib

Private front-end for Reddit
GNU Affero General Public License v3.0
1.38k stars 96 forks source link

🐛 Bug Report: Rate Limit error #237

Closed SteffenBauer closed 2 months ago

SteffenBauer commented 2 months ago

Describe the bug

Redlib started to throw JSON parse errors since yesterday (#229), caused by 403 errors from reddit. Redlib was patched very quickly, but since then Rate Limit errors occur. This is already reported in issue #229 , but I think as this is a new issue it makes sense to open a new bug report.

Steps to reproduce the bug

What's the expected behavior?

Redlib continues to show reddit content

Additional context / screenshot

Couldn't send request to Reddit: Rate limit - try refreshing soon | /r/popular/hot.json?&raw_json=1&geo_filter=GLOBAL

Message in systemd journal log:

Sep 17 08:55:26 hufflepuff redlib[1763]:  ERROR redlib::utils > Error page rendered: Couldn't send request to Reddit: Rate limit - try refreshing soon
SteffenBauer commented 2 months ago

Additional information:

Tokarak commented 2 months ago

Exactly the same situation and experience.

Tokarak commented 2 months ago

Relevant code: https://github.com/redlib-org/redlib/blob/8ef45456d696b254b0378b75ff4db0345d6bc217/src/client.rs#L266-L270

pimlie commented 2 months ago

While testing that PR @perennialtech linked, I found that when I kept relatively quickly refreshing I sometimes was rate limited but could almost always recover by just refreshing the page. But when after N requests I stopped refreshing for X amount of time (like a minute or more) then I immediately got rate limited in the next refresh in a way that wasn't recoverable with a new token.

As restarting also seems to always work, it makes me think it might be a connection timeout / keep-alive related issue? Not sure if rust/redlib re-uses the same connection on successive requests to upstream?

sigaloid commented 2 months ago

Closing as duplicate of #229