From 72efe9731b9ee7e78506485c7af46c60417c1d70 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Fri, 13 Feb 2026 07:12:02 -0700 Subject: [PATCH] Fix persistent 429: bust JS cache, stagger all API calls sequentially - Add ?v=2 cache busting to all JS script tags (old version was cached) - Reduce nginx JS cache from 1y to 1h with must-revalidate - fetchChainData now sequential (was 4 parallel requests per chain) - Increase chain detection delay from 150ms to 300ms Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 8 ++++++-- js/safe-api.js | 16 +++++++++------- wallet-multichain-visualization.html | 6 +++--- wallet-timeline-visualization.html | 6 +++--- wallet-visualization.html | 6 +++--- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 945db33..91a20e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,15 @@ RUN echo 'server { \ try_files $uri $uri/ /index.html; \ } \ \ - # Cache static assets \ - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { \ + # Cache static assets (short TTL for JS to allow updates) \ + location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { \ expires 1y; \ add_header Cache-Control "public, immutable"; \ } \ + location ~* \.(js|css)$ { \ + expires 1h; \ + add_header Cache-Control "public, must-revalidate"; \ + } \ \ # Gzip compression \ gzip on; \ diff --git a/js/safe-api.js b/js/safe-api.js index c3d13a2..9365667 100644 --- a/js/safe-api.js +++ b/js/safe-api.js @@ -162,7 +162,7 @@ const SafeAPI = (() => { } catch (e) { // Chain doesn't have this Safe or API error - skip } - await sleep(150); + await sleep(300); } return results; @@ -173,12 +173,14 @@ const SafeAPI = (() => { * Returns { info, balances, outgoing, incoming } */ async function fetchChainData(address, chainId) { - const [info, balances, outgoing, incoming] = await Promise.all([ - getSafeInfo(address, chainId), - getBalances(address, chainId), - getAllMultisigTransactions(address, chainId), - getAllIncomingTransfers(address, chainId), - ]); + // Fetch sequentially to avoid rate limits + const info = await getSafeInfo(address, chainId); + await sleep(200); + const balances = await getBalances(address, chainId); + await sleep(200); + const outgoing = await getAllMultisigTransactions(address, chainId); + await sleep(200); + const incoming = await getAllIncomingTransfers(address, chainId); return { chainId, info, balances, outgoing, incoming }; } diff --git a/wallet-multichain-visualization.html b/wallet-multichain-visualization.html index 42e16ff..0d7c5a0 100644 --- a/wallet-multichain-visualization.html +++ b/wallet-multichain-visualization.html @@ -5,9 +5,9 @@ Multi-Chain Flow | rWallet.online - - - + + +