dankgrinder 8.17.0 → 8.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/grinder.js +7 -20
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -2654,15 +2654,15 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2654
2654
|
const fetchOpts = CLOUD_MODE ? { cloud: true } : {};
|
|
2655
2655
|
let data = await fetchConfig(4, 2000, fetchOpts);
|
|
2656
2656
|
while (!data) {
|
|
2657
|
-
log('
|
|
2658
|
-
log('warn', `Will retry in 10s (check internet/API URL if this repeats).`);
|
|
2657
|
+
console.log('Cannot connect to API - retrying in 10s...');
|
|
2659
2658
|
await new Promise((r) => setTimeout(r, 10000));
|
|
2660
2659
|
data = await fetchConfig(4, 2000, fetchOpts);
|
|
2661
2660
|
}
|
|
2662
2661
|
if (data && data.error) {
|
|
2663
|
-
log(
|
|
2662
|
+
console.log(`API error: ${data.error}`);
|
|
2664
2663
|
return;
|
|
2665
2664
|
}
|
|
2665
|
+
console.log(`Fetched ${data.accounts?.length || 0} accounts`);
|
|
2666
2666
|
|
|
2667
2667
|
// Cloud mode: post heartbeat every 30s
|
|
2668
2668
|
if (CLOUD_MODE) {
|
|
@@ -2693,24 +2693,21 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2693
2693
|
|
|
2694
2694
|
let { accounts } = data;
|
|
2695
2695
|
if (!accounts || accounts.length === 0) {
|
|
2696
|
-
log('
|
|
2696
|
+
console.log('No active accounts. Add them in the dashboard.');
|
|
2697
2697
|
return;
|
|
2698
2698
|
}
|
|
2699
|
+
console.log(`Processing ${accounts.length} accounts...`);
|
|
2699
2700
|
|
|
2700
2701
|
// Cluster mode: filter to only accounts this node can claim
|
|
2701
2702
|
if (CLUSTER_ENABLED) {
|
|
2702
2703
|
const totalBefore = accounts.length;
|
|
2703
2704
|
accounts = await filterClaimableAccounts(accounts);
|
|
2704
|
-
log(
|
|
2705
|
+
console.log(`Cluster: claimed ${accounts.length}/${totalBefore} accounts`);
|
|
2705
2706
|
if (accounts.length === 0) {
|
|
2706
|
-
log('
|
|
2707
|
+
console.log('All accounts claimed by other nodes. Waiting...');
|
|
2707
2708
|
}
|
|
2708
2709
|
}
|
|
2709
2710
|
|
|
2710
|
-
const checks = [];
|
|
2711
|
-
checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${c.white}API${c.reset}`);
|
|
2712
|
-
if (REDIS_URL) checks.push(redis ? `${rgb(52, 211, 153)}✓${c.reset} ${c.white}Redis${c.reset}` : `${rgb(251, 191, 36)}○${c.reset} ${c.dim}Redis (connecting...)${c.reset}`);
|
|
2713
|
-
|
|
2714
2711
|
// Init rawLogger Redis (uses same URL — logs all raw gateway data)
|
|
2715
2712
|
if (REDIS_URL) {
|
|
2716
2713
|
rawLogger.init(REDIS_URL).catch(() => {});
|
|
@@ -2722,7 +2719,6 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2722
2719
|
if (!isThisWorker && w.channel?.id !== channelId) continue;
|
|
2723
2720
|
|
|
2724
2721
|
if (event.type === 'death') {
|
|
2725
|
-
// Update worker's lifesaver count so dashboard ♥ updates in real time
|
|
2726
2722
|
if (event.lifesaversLeft >= 0) {
|
|
2727
2723
|
const prev = w._lifesavers;
|
|
2728
2724
|
w._lifesavers = event.lifesaversLeft;
|
|
@@ -2751,16 +2747,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2751
2747
|
}
|
|
2752
2748
|
}
|
|
2753
2749
|
});
|
|
2754
|
-
checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${c.white}RawLog${c.reset}`);
|
|
2755
|
-
}
|
|
2756
|
-
if (hasZlib) checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${c.white}zlib${c.reset}`);
|
|
2757
|
-
if (WEBHOOK_URL) checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${c.white}Webhook${c.reset}`);
|
|
2758
|
-
if (CLUSTER_ENABLED) {
|
|
2759
|
-
checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${rgb(34, 211, 238)}Cluster${c.reset} ${c.dim}(${NODE_ID.substring(0, 12)})${c.reset}`);
|
|
2760
2750
|
}
|
|
2761
|
-
checks.push(`${rgb(52, 211, 153)}✓${c.reset} ${c.white}${accounts.length} Account${accounts.length > 1 ? 's' : ''}${c.reset}`);
|
|
2762
|
-
console.log(` ${checks.join(' ')}`);
|
|
2763
|
-
console.log('');
|
|
2764
2751
|
|
|
2765
2752
|
// ── Phase 1: Login ─────────────────────────────────────────────
|
|
2766
2753
|
const parsedGapMin = Number.parseInt(String(process.env.LOGIN_GAP_MIN_MS || '50'), 10);
|