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%
Improvements
0
Regressions
0
Untouched
3
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

decompress plaintext encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress plaintext encoding
CodSpeed Performance Gauge
+1%
16.3 µs
16 µs
decompress gzip encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress gzip encoding
CodSpeed Performance Gauge
0%
255.4 µs
254.2 µs
decompress deflate encoding
portal/common/lib/decompress_data.bench.ts::decompressData::decompress deflate encoding
CodSpeed Performance Gauge
0%
248.4 µs
247.8 µs

Commits

Click on a commit to change the comparison range
Base
main
c25cb04
+1%
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
3 months ago
by Tzal3x
0%
Reduce CACHE_EXPIRATION_TIME to 1 minute
9557214
3 months ago
by Tzal3x
0%
Remove unused imports
fb33ce7
3 months ago
by Tzal3x
Home Terms PrivacyDocs