-
Notifications
You must be signed in to change notification settings - Fork 122
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
Sequential Pagination of artist albums never terminates #492
Comments
Thanks for your detailed report, I can reproduce this problem with your code. After adding a logging statement at the pub fn paginate_with_ctx<'a, Ctx: 'a + Send, T, Request>(
ctx: Ctx,
req: Request,
page_size: u32,
) -> Paginator<'a, ClientResult<T>>
where
T: 'a + Unpin + Send + std::fmt::Debug,
Request: 'a + for<'ctx> Fn(&'ctx Ctx, u32, u32) -> RequestFuture<'ctx, T> + Send,
{
use async_stream::stream;
let mut offset = 0;
Box::pin(stream! {
loop {
let request = req(&ctx, page_size, offset);
let page = request.await?;
println!("page: {:?}", page); // newly added logging statement
offset += page.items.len() as u32;
for item in page.items {
yield Ok(item);
}
if page.next.is_none() {
break;
}
}
})
} The standard output:
If you observe carefully, you will notice the Spotify server keep returning 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 |
You could checkout the master branch with latest commit and rerun your code, this problem should be addressed :) |
Thank you, it works with the master branch. I also tested a few API calls with curl and noticed that in this case the This is completely broken and has been for several weeks now... |
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.rs
examplecargo.toml
dependenciesExpected behavior
Program should terminate
Log/Output data
The text was updated successfully, but these errors were encountered: