dankgrinder 7.74.0 → 7.76.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 +4 -3
- package/lib/rawLogger.js +8 -1
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -129,6 +129,8 @@ let API_URL = '';
|
|
|
129
129
|
let REDIS_URL = process.env.REDIS_URL || '';
|
|
130
130
|
let redis = null;
|
|
131
131
|
let workers = [];
|
|
132
|
+
let startTime = 0;
|
|
133
|
+
let shutdownCalled = false;
|
|
132
134
|
|
|
133
135
|
// ── Cluster Mode Config ──────────────────────────────────────
|
|
134
136
|
// NODE_ID uniquely identifies this process in a multi-node cluster.
|
|
@@ -2739,6 +2741,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2739
2741
|
API_KEY = apiKey;
|
|
2740
2742
|
API_URL = apiUrl || process.env.DANKGRINDER_URL || 'http://localhost:3000';
|
|
2741
2743
|
const CLOUD_MODE = opts.cloud === true;
|
|
2744
|
+
startTime = Date.now();
|
|
2742
2745
|
|
|
2743
2746
|
if (CLOUD_MODE) {
|
|
2744
2747
|
// In cloud mode, API_KEY is the CLOUD_ADMIN_KEY — not used for user auth.
|
|
@@ -2760,8 +2763,6 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2760
2763
|
` ${c.dim}·${c.reset} ${rgb(52, 211, 153)}Auto-Recovery${c.reset}` +
|
|
2761
2764
|
` ${c.dim}·${c.reset} ${rgb(251, 191, 36)}Loss Limiter${c.reset}`
|
|
2762
2765
|
);
|
|
2763
|
-
console.log(bar);
|
|
2764
|
-
|
|
2765
2766
|
log('info', `${c.dim}Fetching accounts...${c.reset}`);
|
|
2766
2767
|
|
|
2767
2768
|
const fetchOpts = CLOUD_MODE ? { cloud: true } : {};
|
|
@@ -2826,7 +2827,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2826
2827
|
|
|
2827
2828
|
// Init rawLogger Redis (uses same URL — logs all raw gateway data)
|
|
2828
2829
|
if (REDIS_URL) {
|
|
2829
|
-
rawLogger.init(
|
|
2830
|
+
rawLogger.init(redis);
|
|
2830
2831
|
// Listen for DM events across all accounts — update worker state + dashboard LIVE
|
|
2831
2832
|
rawLogger.onDmEvent((event, raw) => {
|
|
2832
2833
|
const channelId = raw.channel_id;
|
package/lib/rawLogger.js
CHANGED
|
@@ -30,7 +30,14 @@ const memRing = [];
|
|
|
30
30
|
let memIdx = 0;
|
|
31
31
|
|
|
32
32
|
// ── Redis init ──
|
|
33
|
-
async function init(
|
|
33
|
+
async function init(redisUrlOrInstance) {
|
|
34
|
+
// Support passing an existing Redis instance directly (preferred)
|
|
35
|
+
if (redisUrlOrInstance && typeof redisUrlOrInstance.status !== 'undefined') {
|
|
36
|
+
redis = redisUrlOrInstance;
|
|
37
|
+
redisReady = redis.status === 'ready';
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const redisUrl = redisUrlOrInstance;
|
|
34
41
|
if (!redisUrl) {
|
|
35
42
|
console.log('[rawLogger] No Redis URL — raw logging disabled');
|
|
36
43
|
return;
|