Closed thirteenowls closed 3 months ago
Thanks for your contribution, the CI tasks are failed, would you consider to fix them?
Sure. The failure is unrelated to this contribution, so I've opened a new PR. I'll rebase this one on it once it's merged.
Merged, thanks for your contribution.
Description
Makes use of the
next
field to end pagination early, instead of waiting for Spotify's API to return no data.Motivation and Context
Currently,
PageIterator
always sends one extra request to the API, because it does not checknext
to know if more data is available (unlike its async equivalent).Dependencies
None.
Type of change
Please delete options that are not relevant.
How has this been tested?
This has been tested by adding a
dbg!
call right before sending a request inPageIterator
's impl, then running thepagination_sync
example with and without this change. Tests were run using an account with 51 saved tracks, which should require two requests withlimit
set to 50.This is
pagination_sync
's output before the change:And this is its output after the change:
The output is the same, but the extraneous request has been eliminated.
Is this change properly documented?
N/A