Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Lost data. Not idempotent response #114

@msize

Description

@msize

Steps to reproduce

At the 2020-01-27T04:01:12Z we sent a request:

GET https://api.partnercenter.microsoft.com/v1/customers/{CUSTOMER}/subscriptions/{SUBSCRIPTION}/utilizations/azure?start_time=2020-01-26T02:00:00Z&end_time=2020-01-26T22:00:00Z&granularity=Hourly&show_details=true&size=500

And then received a response with code 200 OK and content-Length 318120. This response contained the next link. And we sent next request:

GET https://api.partnercenter.microsoft.com/v1/customers/{CUSTOMER}/subscriptions/{SUBSCRIPTION}/utilizations/azure?seek_operation=Next

And then received a response with code 204 No Content and content-Length 0.

It is bad. Because the response is not complete. And if we'll repeat this operation today it's returns data. And then more 9 pages.

In the application, we use IResourceCollectionEnumerator and methods hasValue and next. Like this:

final ResourceCollection<AzureUtilizationRecord> utilization = getUtilization(partner, usage);
if (utilization == null) {
    return;
}
final IResourceCollectionEnumerator<ResourceCollection<AzureUtilizationRecord>> pages =
        partner.getEnumerators().getUtilization().getAzure().create(utilization);

while (pages.hasValue()) {
    usage.append(pages.getCurrent().getItems(), price);
    pages.next();
}

And as you can see, we can't detect when the response is not complete and when it full. And this behavior became an issue with lost some data for us.

Expected behavior

Throw exception if the Next operation hasn't data.

Actual behavior

Returns empty data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions