mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-25 23:45:52 +03:00
[GH-ISSUE #492] Sequential Pagination of artist albums never terminates #160
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @infality on GitHub (Sep 1, 2024).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/492
Describe the bug
When fetching an artist's albums using the async pagination the request goes on endlessly.
The albums are fetched successfully, but then the while loop does not terminate. I can even see that there is traffic happening on the network interface. I let it run for 1-2 minutes before killing it. Happens with different artists as well.
I'm using pretty much the same code as the sequential example from
pagination_async.rs.I don't use Rust async a lot, so this may be as well an error on my part, but I'm pretty sure this used to terminate before.
To Reproduce
Taken mostly from the
pagination_async.rsexamplecargo.tomldependenciesExpected behavior
Program should terminate
Log/Output data
@ramsayleung commented on GitHub (Sep 13, 2024):
Thanks for your detailed report, I can reproduce this problem with your code. After adding a logging statement at the
paginate_with_ctxfunction, I figure out what's going wrong:The standard output:
If you observe carefully, you will notice the Spotify server keep returning
nextfield(which is not None), but theitemsis empty, it totally doesn't make sense that the response doesn't contain item in the current page, but you are telling me that you have more items in the next page.Now Spotify is also telling me this artist has 97 albums, it's a lie(or you could call it as a bug). I've tested this album in the web console provided by Spotify, they only have 4 items.
Obviously, there are two bugs on the Spotify server side, I will create a patch to bypass this problem by checking the
itemsfield, it's a bit frustrating for library developer to keep taking care of the problems caused by Spotify.@ramsayleung commented on GitHub (Sep 13, 2024):
You could checkout the master branch with latest commit and rerun your code, this problem should be addressed :)
@infality commented on GitHub (Sep 13, 2024):
Thank you, it works with the master branch.
I also tested a few API calls with curl and noticed that in this case the
nextfield is only null ifoffsetis greater than 46. With other artists the threshold is somewhere else.I also saw a total album count of 682 on another artist.
This is completely broken and has been for several weeks now...
At least I know now that the problem was not on my end :)