lestrrat-go / httprc

Quasi Up-to-date HTTP In-memory Cache
MIT License
17 stars 5 forks source link

Release lock if fetchAndStore fail #5

Closed mpeterss closed 2 years ago

mpeterss commented 2 years ago

If there is a failure while doing a forceRefresh on the cache, it will never release the lock. This means that any following request to the cache will just hang as the call to e.acquireSem() will wait forever.

mpeterss commented 2 years ago

@lestrrat I noticed this issue when using the jwks cache in https://github.com/lestrrat-go/jwx/tree/develop/v2/jwk. If there is an error when calling Refresh on the cache it gets into a state where the cache never gets updated again. So if this PR gets merged please update the package in go-jwx as well.

lestrrat commented 2 years ago

oh yikes, thanks.

sorry I didn't notice your initial comment, I needed to setup notification for this repo

codecov-commenter commented 2 years ago

Codecov Report

Merging #5 (be38932) into main (8e06023) will increase coverage by 0.11%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
+ Coverage   61.25%   61.36%   +0.11%     
==========================================
  Files           6        6              
  Lines         351      352       +1     
==========================================
+ Hits          215      216       +1     
  Misses        123      123              
  Partials       13       13              
Impacted Files Coverage Δ
cache.go 66.66% <100.00%> (+0.66%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8e06023...be38932. Read the comment docs.