Intelligence, Advanced Charting & Trading Platform
test(incident): retry intermittent public preview GET failures without changing live data
davoodmehraban89 committed
Oct 15, 2026 at 19:38 UTC
cd846cd05e4d9dbbd3cee76fe761d0675aab61f3
1 file changed
+7
-2
scripts/diagnose-chartnova-v27-preview.mjs
+7
-2
@@ -9,8 +9,13 @@ import { Script } from 'node:vm';
9
const V27='https://2cbeb4e2-velyqor-preview.davoodmehraban89.workers.dev/';
10
const V26='https://app.chartnova.ir/';
11
const readHtml=async url=>{
12
- const response=await fetch(url,{signal:AbortSignal.timeout(18000)});
13
- if(!response.ok)throw Error('Unable to fetch versioned HTML, HTTP '+response.status);
12
+ let response=null;
13
+ for(let attempt=0;attempt<3;attempt++){
14
+ try{ response=await fetch(url,{signal:AbortSignal.timeout(18000)}); if(response.ok)break; }
15
+ catch(e){if(attempt===2)throw Error('versioned_HTML_network_unavailable_after_3_attempts');}
16
+ if(attempt<2)await new Promise(done=>setTimeout(done,1000*(attempt+1)));
17
+ }
18
+ if(!response?.ok)throw Error('Unable to fetch versioned HTML after retries, HTTP '+response?.status);
19
const html=await response.text();
20
const js=html.match(/<script>([\s\S]*?)<\/script>/)?.[1];
21
if(!js||!html.includes('class="shell"'))throw Error('No classic ChartNova shell / JS in version URL');