• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ben-manes / caffeine / #3109
100%

Build:
DEFAULT BRANCH: master
Ran 29 May 2022 07:04PM UTC
Jobs 1
Files 77
Run time 5s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
#3109

push

github-actions

ben-manes
Less aggressively discard refreshes due to possible conflicts

Linearization means that the refresh should be dropped if another write
for that entry occurs, as we may populate the cache with stale data. The
cache used a write timestamp to help detect this. However, when this
could be too aggressive when a refresh runs concurrently with the async
load completing.

An inflight load is given an infinite timestamp so that it never expires.
A whenComplete callback then updates the entry with its policy metadata,
such as its expiration time. That changes the write timestamp and if a
refresh runs concurrently with the callback then the refresh may see the
infinite timestamp, the replace updates it, and the refresh drops the
entry as a conflict.

Instead, if the refresh is successfully unregistered within the entry's
compute to swap the value, then it can be assumed to be valid. Any other
write will discard the refresh under the entry's compute, so we retain
linearizability. This requires that the load callback to update the
metadata does not discard the refresh, since that is not needed for a
psuedo write.

The write timestamp trick for ABA detection is a layover from the
previous implementation (2.x) which did not promise linearization.

Note that a refresh is optimistic and races with other writes, so it
may be discarded. As it relies on callbacks to write back into the
cache, one cannot expect the entry to be updated after the reload
completes (e.g. see #714).

7061 of 7196 relevant lines covered (98.12%)

0.98 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #3109.1 29 May 2022 07:04PM UTC 0
98.12
Source Files on build #3109
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #3109
  • 9c6c5edb on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc