Skip to content

Requesting fewer records than one page causes infinite loop #8

@jmosul

Description

@jmosul

When making a request that results in fewer results than contained in a single response of the API, request will be repeated infinitely.

See example below:

    const structure = {
        date: 'date',
        areaName: 'areaName',
        cumPeopleVaccinatedFirstDoseByPublishDate: 'cumPeopleVaccinatedFirstDoseByPublishDate',
    };

    const filters = ['areaType=nation'];

    const api = new Cov19API({
        filters,
        structure,
        latestBy: 'cumPeopleVaccinatedFirstDoseByPublishDate',
    });

I would expect this to have been caused by a change to the API that means page 1 returns the same result as page 2. As can be seen in the below examples.

Example Page 1

Example Page 2

With API.getData looping until it receives a 204 or an error, this will now loop indefinitely:

https://github.com/publichealthengland/coronavirus-dashboard-api-javascript-sdk/blob/7ac7f6fbc06450a122ea446ee4fe78023eb4950d/lib/UKCovid19.ts#L120-L137

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