trustbloc / sidetree-fabric

Implementation of Sidetree with a backing Hyperledger Fabric ledger
Apache License 2.0
26 stars 13 forks source link

fix: Fix race condition in document cache #478

Closed bstasyszyn closed 3 years ago

bstasyszyn commented 3 years ago

This commit fixes a race condition which exists in the document cache. The scenario is as follows:

In order to fix this race condition, instead of deleting the document from the cache, the document is marked stale. So, the next time it is retrieved from the cache it will show as stale and the document will be loaded from the store.

closes #477

Signed-off-by: Bob Stasyszyn Bob.Stasyszyn@securekey.com

codecov[bot] commented 3 years ago

Codecov Report

Merging #478 (91dcd5e) into master (87db0ae) will decrease coverage by 0.05%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #478      +/-   ##
==========================================
- Coverage   92.50%   92.45%   -0.06%     
==========================================
  Files          81       81              
  Lines        3242     3286      +44     
==========================================
+ Hits         2999     3038      +39     
- Misses        161      165       +4     
- Partials       82       83       +1     
Impacted Files Coverage Δ
pkg/context/doccache/doccache.go 96.77% <100.00%> (+2.89%) :arrow_up:
pkg/observer/processor.go 84.89% <0.00%> (-3.60%) :arrow_down:

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 87db0ae...91dcd5e. Read the comment docs.