dankgrinder 7.69.0 → 7.71.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 +22 -15
- package/lib/rawLogger.js +4 -1
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -133,10 +133,25 @@ const CLUSTER_PREFIX = 'dkg:cluster:';
|
|
|
133
133
|
function initRedis() {
|
|
134
134
|
if (!redis && REDIS_URL) {
|
|
135
135
|
try {
|
|
136
|
-
redis = new Redis(REDIS_URL, {
|
|
137
|
-
|
|
136
|
+
redis = new Redis(REDIS_URL, {
|
|
137
|
+
maxRetriesPerRequest: 3,
|
|
138
|
+
retryStrategy: (times) => times > 5 ? null : Math.min(times * 500, 3000),
|
|
139
|
+
lazyConnect: true,
|
|
140
|
+
});
|
|
141
|
+
redis.connect().catch((e) => {
|
|
142
|
+
// Only warn once — don't spam on persistent connection failures
|
|
143
|
+
if (!redis || redis.status === 'wait') {
|
|
144
|
+
console.warn(`[Redis] connection failed: ${e.message} — continuing without Redis`);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
redis.on('error', (e) => {
|
|
148
|
+
// Suppress common transient errors from spamming stderr
|
|
149
|
+
const msg = e?.message || '';
|
|
150
|
+
if (msg.includes('ETIMEDOUT') || msg.includes('ECONNRESET') || msg.includes('ENOTFOUND') || msg.includes('connect')) return;
|
|
151
|
+
console.error(`[Redis] error: ${msg}`);
|
|
152
|
+
});
|
|
138
153
|
} catch (e) {
|
|
139
|
-
|
|
154
|
+
// Redis optional — continue without it
|
|
140
155
|
}
|
|
141
156
|
}
|
|
142
157
|
}
|
|
@@ -2872,8 +2887,6 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2872
2887
|
await new Promise((r) => setTimeout(r, 10000));
|
|
2873
2888
|
data = await fetchConfig(4, 2000, fetchOpts);
|
|
2874
2889
|
}
|
|
2875
|
-
console.log(`[DEBUG] fetched config, accounts: ${data?.accounts?.length || 0}`);
|
|
2876
|
-
|
|
2877
2890
|
if (data && data.error) {
|
|
2878
2891
|
log('error', `${data.error}`);
|
|
2879
2892
|
return;
|
|
@@ -3348,26 +3361,20 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
3348
3361
|
|
|
3349
3362
|
console.log(` ${rgb(139, 92, 246)}${c.bold}>>>${c.reset} ${gradientText('Starting grind loops...', [139, 92, 246], [52, 211, 153])}`);
|
|
3350
3363
|
|
|
3351
|
-
console.log(`[DEBUG] activeWorkers count: ${activeWorkers.length}`);
|
|
3352
|
-
for (let i = 0; i < Math.min(activeWorkers.length, 5); i++) {
|
|
3353
|
-
const w = activeWorkers[i];
|
|
3354
|
-
console.log(`[DEBUG] worker[${i}]: ${w.username}, running=${w.running}, client=${!!w.client}, channel=${!!w.channel}`);
|
|
3355
|
-
}
|
|
3356
|
-
|
|
3357
3364
|
// Phase 3: Start all grind loops (only for valid workers)
|
|
3358
3365
|
for (const w of activeWorkers) {
|
|
3359
|
-
console.log(`[DEBUG] calling grindLoop on: ${w.username}`);
|
|
3360
3366
|
if (!shutdownCalled) w.grindLoop();
|
|
3361
3367
|
}
|
|
3362
3368
|
|
|
3363
3369
|
startTime = Date.now();
|
|
3364
|
-
console.log(`[DEBUG] dashboardStarted set to true`);
|
|
3365
3370
|
dashboardStarted = true;
|
|
3366
3371
|
setDashboardActive(true);
|
|
3372
|
+
|
|
3373
|
+
// Clear screen and position cursor at top-left before dashboard takes over
|
|
3374
|
+
process.stdout.write('\x1b[2J\x1b[H');
|
|
3375
|
+
|
|
3367
3376
|
// Setup keyboard shortcuts
|
|
3368
3377
|
setupKeyboardShortcuts();
|
|
3369
|
-
// Cursor hide to reduce visual noise during renders
|
|
3370
|
-
process.stdout.write(c.hide);
|
|
3371
3378
|
|
|
3372
3379
|
// Re-render on terminal resize so layout adapts to window size
|
|
3373
3380
|
process.stdout.on('resize', () => {
|
package/lib/rawLogger.js
CHANGED
|
@@ -54,7 +54,10 @@ async function init(redisUrl) {
|
|
|
54
54
|
redisReady = true;
|
|
55
55
|
console.log('[rawLogger] Redis connected');
|
|
56
56
|
redis.on('error', (e) => {
|
|
57
|
-
|
|
57
|
+
// Suppress common transient network errors from spamming stderr
|
|
58
|
+
const msg = e?.message || '';
|
|
59
|
+
if (msg.includes('ETIMEDOUT') || msg.includes('ECONNRESET') || msg.includes('ENOTFOUND') || msg.includes('read') || msg.includes('connect')) return;
|
|
60
|
+
console.error(`[rawLogger] Redis error: ${msg}`);
|
|
58
61
|
redisReady = false;
|
|
59
62
|
});
|
|
60
63
|
redis.on('close', () => {
|