ipfs / helia-delegated-routing-v1-http-api

The Routing V1 HTTP API powered by Helia
Other
3 stars 4 forks source link

fix: fixes cache leak and unhandled promise rejection #152

Closed achingbrain closed 2 weeks ago

achingbrain commented 2 weeks ago

Fixes some bugs in the new request cache:

  1. When stopping the client we were supposed to remove the response cache, instead we were deleting an item from the cache
  2. When stopping we were voiding the cache deletion - this can cause unhandled promise rejections so switches to awaiting the promise instead
  3. When starting the cache was being created asynchronously but without waiting for the promise to resolve, so you could stop the client before the cache was intialized which would mean it is never cleaned up

Also not a bug but it also makes the cache name configurable.

Change checklist

2color commented 2 weeks ago

Btw, are you certain that we call start in consumers of the client (Helia and libp2p)?

achingbrain commented 2 weeks ago

Yes, we call .start and .stop from the locations you link to.

achingbrain commented 2 weeks ago

Also sorry for not getting to the review of #151 in time, this PR is me doing it post-merge.

github-actions[bot] commented 2 weeks ago

:tada: This PR is included in version @helia/delegated-routing-v1-http-api-client-v4.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: