sneakers-the-rat / paper-feeds

A FastAPI web server for creating RSS feeds for scholarly journals with the magic of adversarial interoperability
GNU General Public License v3.0
60 stars 4 forks source link

Fix infinite loop when journal contains fewer papers than the default limit #14

Closed ybnd closed 6 months ago

ybnd commented 6 months ago

Apparently fetch_papers/populate_papers keeps fetching an empty page forever if the total number of papers in a journal is less than the default limit of a 1000.

To reproduce: create RSS feed for "Sensors and Actuators Reports" (ISSN: 2666-0539)

The fix is a bit quick & messy, but I can't really think of anything better right now (without refactoring a bunch).

sneakers-the-rat commented 6 months ago

Aha yes I was noticing this just before I stopped working last night. I think it would be as simple as checking if the number of results is less than what was requested, but lemme take a closer look when I get to desk

sneakers-the-rat commented 6 months ago

fixed in https://github.com/sneakers-the-rat/journal-rss/commit/0fad2e99d990c08751b1be6c96d6f0dd00356793

sry usually i try and consult more on PRs but it's late and i'm hungry and need ta go home but wanted to finish this one as a last win.

I went with a check that just depends on the information already in the function, it seemed like the _clean_papers function shouldn't know about the total number of papers. thanks for reporting this!!!!!