ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
812 stars 81 forks source link

fix: prevent duplicate trustless-gateway reqs #503

Closed SgtPooki closed 2 months ago

SgtPooki commented 2 months ago

Title

fix: prevent duplicate trustless-gateway reqs

Description

Fixes https://github.com/ipfs-shipyard/service-worker-gateway/issues/104

This PR fixes issues brought up in service-worker-gateway where sub-resources end up causing multiple requests to a trustless gateway for the root CID.

Notes & open questions

I feel like the blockstore should handle this and ensure requests that depend on a root CID are deduped, but since trustless-gateways may be used outside of the context of blockstores, I believe we still need this improvement.

Change checklist

SgtPooki commented 2 months ago

note the previous failure in CI: https://github.com/ipfs/helia/actions/runs/8745897909/job/24001821684?pr=503#step:5:793

And it should be fixed by 97a05e4 (#503)

SgtPooki commented 2 months ago

One thing I thought of after stepping away last night: we should probably use finally to remove entry from map

SgtPooki commented 2 months ago

CI failed but not due to changes here AFAICT: https://github.com/ipfs/helia/actions/runs/8760997666/job/24046923998?pr=503#step:5:240