dankgrinder 8.844.0 → 8.1171.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/rawLogger.js +13 -13
- package/package.json +1 -1
package/lib/rawLogger.js
CHANGED
|
@@ -446,20 +446,20 @@ async function store(d, event) {
|
|
|
446
446
|
const MAX_LOG = 99; // tiny cap
|
|
447
447
|
|
|
448
448
|
const pipe = redis.pipeline();
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
449
|
+
// Per-command log — only recent IDs, tiny cap, short TTL
|
|
450
|
+
if (parsed.command) {
|
|
451
|
+
const cmdKey = `raw:cmd:${parsed.command}:log`;
|
|
452
|
+
pipe.lpush(cmdKey, `${d.id}:${parsed._capturedAt}:${event}`);
|
|
453
|
+
pipe.ltrim(cmdKey, 0, MAX_LOG);
|
|
454
|
+
pipe.expire(cmdKey, LOG_TTL);
|
|
455
|
+
}
|
|
456
|
+
// Global log — tiny cap, short TTL
|
|
457
|
+
pipe.lpush('raw:all:log', `${d.id}:${parsed._capturedAt}:${event}:${parsed.command}:${d.channel_id}`);
|
|
458
|
+
pipe.ltrim('raw:all:log', 0, 499);
|
|
459
|
+
pipe.expire('raw:all:log', LOG_TTL);
|
|
460
460
|
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
pipe.exec().catch(() => {}); // fire and forget
|
|
462
|
+
} catch {}
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
return parsed;
|