Skip to content

Handle error 429 and Retry-After header #235

Open

Description

@severo

See #213 (comment) and #213 (comment)

When receiving error 429 when fetching Parquet data, we could:

  • read the Retry-After header if present, otherwise use a default retry delay
  • wait for this delay then retry
  • show a temporary error message (toast?). If we identify that the source is Hugging Face (only in https://github.com/hyparam/space for now), we could propose to login if it's not already the case, because passing a token raises the rate limiting threshold.

Activity

  1. severo commented on May 22, 2025

    @severo
    ContributorAuthor

    Note that hyperparam fetches the data from a web worker. We pass from to the worker through a message, but it's not possible to pass a function. So: the custom fetch function (like https://www.npmjs.com/package/fetch-retry) should be defined in the worker. Possibly some parameters (default retry delay, etc) could be passed in the message if needed

    As an alternative, the worker could send details about the error (429 + retry-after if any), and let the client control the flow of fetches.

    In either ways, it's not trivial.

  2. severo commented on May 22, 2025

    @severo
    ContributorAuthor

    Also, I reproduced the issue:

    1. launch npm run dev
    2. enter http://localhost:5173/?key=https://huggingface.co/datasets/HuggingFaceFW/fineweb/resolve/main/data/CC-MAIN-2013-20/000_00000.parquet
    3. open the network panel in the developer tools
    4. sort along the language column

    In my test, it created 2,184 requests, and about 150 of them are CORS errors, i.e., no response, no 429 code, and no Retry-After header. Not easy to handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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