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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-13 07:12:02 -07:00
parent 7c3f825c80
commit 72efe9731b
5 changed files with 24 additions and 18 deletions

View File

@ -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; \

View File

@ -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 };
}

View File

@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multi-Chain Flow | rWallet.online</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="js/safe-api.js"></script>
<script src="js/data-transform.js"></script>
<script src="js/router.js"></script>
<script src="js/safe-api.js?v=2"></script>
<script src="js/data-transform.js?v=2"></script>
<script src="js/router.js?v=2"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {

View File

@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Balance River | rWallet.online</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="js/safe-api.js"></script>
<script src="js/data-transform.js"></script>
<script src="js/router.js"></script>
<script src="js/safe-api.js?v=2"></script>
<script src="js/data-transform.js?v=2"></script>
<script src="js/router.js?v=2"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {

View File

@ -6,9 +6,9 @@
<title>Single-Chain Flow | rWallet.online</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-sankey@0.12.3/dist/d3-sankey.min.js"></script>
<script src="js/safe-api.js"></script>
<script src="js/data-transform.js"></script>
<script src="js/router.js"></script>
<script src="js/safe-api.js?v=2"></script>
<script src="js/data-transform.js?v=2"></script>
<script src="js/router.js?v=2"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {