nftstorage / nftstorage.link

🪐 NFT.Storage Gateway, the IPFS gateway for NFT.Storage is not "another gateway", but a caching layer for NFTs that sits on top of existing IPFS public gateways. ***Notice: Uploads have been decommissioned.**** Learn more and find a new hot storage provider for uploading new assets: nft.storage/nft-storage-classic
https://nft.storage/nft-storage-classic
Other
46 stars 10 forks source link

fix: api permacache post always read and write #97

Closed vasco-santos closed 2 years ago

vasco-santos commented 2 years ago

This PR removes Head request to R2 on Post, which results on a GET+PUT every time a permacache post operation happens. The main goal is to avoid race conditions on {POST,DELETE} ops.

Talked this with @mikeal , we can improve after MVP by not deleting right away, but flag URLs for deleting and have a GC post processing system in place. With that, we could go back to use Head Request, but no need to this optimization right away. So, we should just write every time for now given the use case we try to prevent is a READ from R2 already (with same cost as HEAD) and it will be quite fast to proceed.

cloudflare-pages[bot] commented 2 years ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e046410
Status: ✅  Deploy successful!
Preview URL: https://36e67d94.nftstorage-link.pages.dev

View logs