dankgrinder 8.19.0 → 8.20.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 +2 -0
- package/lib/rawLogger.js +12 -2
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -2763,10 +2763,12 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2763
2763
|
const batch = accounts.slice(i, Math.min(i + BATCH_SIZE, accounts.length));
|
|
2764
2764
|
await Promise.all(batch.map(async (acc, idx) => {
|
|
2765
2765
|
if (idx > 0) await new Promise(r => setTimeout(r, 100 + Math.floor(Math.random() * 500)));
|
|
2766
|
+
console.log(` [${i + idx + 1}] starting: ${acc.label || acc.id}`);
|
|
2766
2767
|
const worker = new AccountWorker(acc, i + idx);
|
|
2767
2768
|
workers.push(worker);
|
|
2768
2769
|
workerMap.set(acc.id, worker);
|
|
2769
2770
|
await worker.start();
|
|
2771
|
+
console.log(` [${i + idx + 1}] done: ${acc.label || acc.id}`);
|
|
2770
2772
|
if (worker._tokenInvalid) {
|
|
2771
2773
|
console.log(` [${i + idx + 1}] FAIL - invalid token: ${acc.label || acc.id}`);
|
|
2772
2774
|
} else if (worker.channel) {
|
package/lib/rawLogger.js
CHANGED
|
@@ -40,8 +40,14 @@ async function init(redisUrl) {
|
|
|
40
40
|
redis = new Redis(redisUrl, {
|
|
41
41
|
maxRetriesPerRequest: 2,
|
|
42
42
|
retryStrategy: (times) => times > 3 ? null : Math.min(times * 500, 3000),
|
|
43
|
-
lazyConnect:
|
|
43
|
+
lazyConnect: true,
|
|
44
44
|
});
|
|
45
|
+
// Skip if already connecting or connected
|
|
46
|
+
if (redis.status === 'connecting' || redis.status === 'connect' || redis.status === 'ready') {
|
|
47
|
+
console.log('[rawLogger] Redis already connecting — skipping');
|
|
48
|
+
redisReady = false;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
45
51
|
// Wait for actual connection before marking ready
|
|
46
52
|
await new Promise((resolve, reject) => {
|
|
47
53
|
const timeout = setTimeout(() => {
|
|
@@ -70,7 +76,11 @@ async function init(redisUrl) {
|
|
|
70
76
|
redisReady = true;
|
|
71
77
|
});
|
|
72
78
|
} catch (e) {
|
|
73
|
-
|
|
79
|
+
// Suppress "already connecting" errors — happens when Redis reconnects mid-init
|
|
80
|
+
const msg = e?.message || '';
|
|
81
|
+
if (!msg.includes('already connecting') && !msg.includes('already connected')) {
|
|
82
|
+
console.error(`[rawLogger] Redis connect failed: ${msg}`);
|
|
83
|
+
}
|
|
74
84
|
redis = null;
|
|
75
85
|
redisReady = false;
|
|
76
86
|
}
|