dms-middleware-auth 1.1.9 → 1.2.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/dist/auth.middleware.js +4 -4
- package/package.json +1 -1
- package/src/auth.middleware.ts +12 -15
package/dist/auth.middleware.js
CHANGED
|
@@ -366,10 +366,10 @@ let AuthMiddleware = AuthMiddleware_1 = class AuthMiddleware {
|
|
|
366
366
|
async cacheSetSeconds(key, value, _ttlSeconds) {
|
|
367
367
|
try {
|
|
368
368
|
// Force a consistent one-day TTL in seconds; clamp to avoid 32-bit timer overflow even if a store multiplies by 1000
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
await this.cacheManager.set(key, value,
|
|
372
|
-
this.logger.debug(`Cache set: ${key} (TTL: ${
|
|
369
|
+
// Use a simple, safe 24-hour TTL; 86,400s (86,400,000ms if misread as ms) is far below the Node timer limit.
|
|
370
|
+
const ttlSeconds = AuthMiddleware_1.LIC_CACHE_TTL_SECONDS; // 24 * 60 * 60
|
|
371
|
+
await this.cacheManager.set(key, value, ttlSeconds);
|
|
372
|
+
this.logger.debug(`Cache set: ${key} (TTL: ${ttlSeconds}s)`);
|
|
373
373
|
}
|
|
374
374
|
catch (e) {
|
|
375
375
|
this.logger.error(`Cache set failed for key=${key}: ${e?.message || e}`, e?.stack);
|
package/package.json
CHANGED
package/src/auth.middleware.ts
CHANGED
|
@@ -440,18 +440,15 @@ export class AuthMiddleware implements NestMiddleware, OnModuleInit {
|
|
|
440
440
|
// -------------------------
|
|
441
441
|
// Cache helper with overflow protection
|
|
442
442
|
// -------------------------
|
|
443
|
-
private async cacheSetSeconds(key: string, value: any, _ttlSeconds: number) {
|
|
444
|
-
try {
|
|
445
|
-
// Force a consistent one-day TTL in seconds; clamp to avoid 32-bit timer overflow even if a store multiplies by 1000
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
);
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
443
|
+
private async cacheSetSeconds(key: string, value: any, _ttlSeconds: number) {
|
|
444
|
+
try {
|
|
445
|
+
// Force a consistent one-day TTL in seconds; clamp to avoid 32-bit timer overflow even if a store multiplies by 1000
|
|
446
|
+
// Use a simple, safe 24-hour TTL; 86,400s (86,400,000ms if misread as ms) is far below the Node timer limit.
|
|
447
|
+
const ttlSeconds = AuthMiddleware.LIC_CACHE_TTL_SECONDS; // 24 * 60 * 60
|
|
448
|
+
await this.cacheManager.set(key, value, ttlSeconds);
|
|
449
|
+
this.logger.debug(`Cache set: ${key} (TTL: ${ttlSeconds}s)`);
|
|
450
|
+
} catch (e: any) {
|
|
451
|
+
this.logger.error(`Cache set failed for key=${key}: ${e?.message || e}`, e?.stack);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|