Skip to content

pypi: cooldown download check makes an uncached upstream request per file #242

Description

@andrew

#240 added a cooldown check to PyPIHandler.handleDownload so tarballs for withheld versions return 404. That check calls fetchFilteredVersions, which issues a direct HTTPClient.Do to <upstream>/pypi/<name>/json (internal/handler/pypi.go:119) rather than going through FetchOrCacheMetadata.

Before #240 this only ran once per simple-index request. Now it runs on every file download when cooldown is enabled, so each wheel or sdist fetch adds a synchronous round-trip to the upstream JSON API. The npm side of the same change already routes through FetchOrCacheMetadata and reuses the metadata cache.

fetchFilteredVersions should fetch via FetchOrCacheMetadata (cache key e.g. <name>/json) so repeated downloads for the same package reuse the cached response within the metadata TTL.

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