Avatar for the MystenLabs user
MystenLabs
walrus-sites
BlogDocsChangelog

fix(service-worker & cache): remove checkCachedVersionMatchesOnChain

#301Merged
Comparing
ta/fix-sw-cache
(
fb33ce7
) with
main
(
c25cb04
)
CodSpeed Performance Gauge
+1%
Untouched
3

Benchmarks

Passed

decompress plaintext encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress plaintext encoding
CodSpeed Performance Gauge
+1%
16.3 µs16 µs
decompress gzip encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress gzip encoding
CodSpeed Performance Gauge
0%
255.4 µs254.2 µs
decompress deflate encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress deflate encoding
CodSpeed Performance Gauge
0%
248.4 µs247.8 µs

Commits

Click on a commit to change the comparison range
Base
main
c25cb04
+0.61%
fix(service-worker & cache): remove checkCachedVersionMatchesOnChain 1. Fixed the issue of the caching mechanism in the service worker. 2. Updated the CACHE_EXPIRATION_TIME to 1 hour. The resolveObjectId function would only be called on the site::Site object and not for each Resource (which makes sense as it is doing the suins-to-objectId resolution). However, this meant that a lot of requests would be tagged as "cache miss" incorrectly, because the site::Site version would be compared with the site::Resource version inside the checkCachedVersionMatchesOnChain. Thinking more about it, the end goal of using a cache is to avoid making requests to the RPC nodes. Always checking for the sui object version contradicts this. Therefore I decided to remove the checkCachedVersionMatchesOnChain altogether. Remember that caches expire, so at some point the resource contents will be updated anyway.
f9839d3
10 months ago
by Tzal3x
-0.19%
Reduce CACHE_EXPIRATION_TIME to 1 minute
9557214
10 months ago
by Tzal3x
+0.31%
Remove unused imports
fb33ce7
10 months ago
by Tzal3x
© 2025 CodSpeed Technology
Home Terms Privacy Docs