ListResources is repeating the last image
I am using the following code to get a list of all resources that match a specific tag. The problem is the results are infinite. The last resource just repeats forever and NextCursor is never null.
Cloudinary cloudinary = new Cloudinary("removed");
cloudinary.Api.Secure = true;
var listResourceParams = new ListResourcesByTagParams()
{
Metadata = true,
Tag = "Lifestyle",
MaxResults = 10
};
var allImages = new List<Resource>();
bool firstRun = true;
while (firstRun || !string.IsNullOrEmpty(listResourceParams.NextCursor))
{
firstRun = false;
var getResourceResult = cloudinary.ListResources(listResourceParams);
allImages.AddRange(getResourceResult.Resources.ToList());
listResourceParams.NextCursor = getResourceResult.NextCursor;
}
-
Hi Karl,
Thanks for reaching out!
I tested out your code and there seems to be no issue with infinite looping.
Perhaps you have another code that is causing the issue?
Best Regards,
John
0 -
I apologize. It was a data issue, there where more images in that tag than I was expecting and many had very similar data.
0 -
Hi Karl. Danny from Cloudinary Support here.
I'm glad to hear you were able to pinpoint where the issue was coming from. If you need us in the future, please don't hesitate to get in touch either with a forum post, or by submitting a new support request.
All the best,
-Danny0
Post is closed for comments.
Comments
3 comments