Brozy123 commited on
Commit
de35619
·
verified ·
1 Parent(s): 4e9f2b5

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +4 -7
index.js CHANGED
@@ -1450,7 +1450,7 @@ async function initialize() {
1450
  server.startServer(client, commandsData);
1451
 
1452
  let retryCount = 0;
1453
- const maxRetryDelay = 15000; // keep retries fast
1454
 
1455
  async function login() {
1456
  if (!TOKEN || TOKEN.length < 10) {
@@ -1461,8 +1461,8 @@ async function initialize() {
1461
  }
1462
 
1463
  try {
1464
- console.log(`[*] Attempting connection to Discord (Attempt ${retryCount + 1})...`);
1465
  await client.login(TOKEN);
 
1466
  } catch (err) {
1467
  console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
1468
 
@@ -1484,12 +1484,9 @@ async function initialize() {
1484
  networkFix.rotateEndpoint();
1485
  }
1486
 
1487
- // Exponential backoff for retries
1488
  retryCount++;
1489
- const delay = Math.min(1000 * Math.pow(2, retryCount), maxRetryDelay);
1490
-
1491
- console.log(`[*] Retrying in ${delay / 1000}s...`);
1492
- setTimeout(login, delay);
1493
  }
1494
  }
1495
 
 
1450
  server.startServer(client, commandsData);
1451
 
1452
  let retryCount = 0;
1453
+ const retryDelayMs = 1000; // aggressive 1s retries
1454
 
1455
  async function login() {
1456
  if (!TOKEN || TOKEN.length < 10) {
 
1461
  }
1462
 
1463
  try {
 
1464
  await client.login(TOKEN);
1465
+ retryCount = 0;
1466
  } catch (err) {
1467
  console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
1468
 
 
1484
  networkFix.rotateEndpoint();
1485
  }
1486
 
1487
+ // Keep retries immediate for fastest reconnect behavior.
1488
  retryCount++;
1489
+ setTimeout(login, retryDelayMs);
 
 
 
1490
  }
1491
  }
1492