fixed lint

This commit is contained in:
Boki 2025-06-26 15:44:52 -04:00
parent 885b484a37
commit 8680b6ec20
2 changed files with 15 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import Redis from 'ioredis';
import { RedisConnectionManager } from './connection-manager';
import type { CacheOptions, CacheProvider, CacheStats } from './types';
import { CACHE_DEFAULTS } from './constants';
import type { CacheOptions, CacheProvider, CacheStats } from './types';
/**
* Simplified Redis-based cache provider
@ -88,17 +88,23 @@ export class RedisCache implements CacheProvider {
let oldValue: T | null = null;
if (opts.getOldValue) {
const existing = await this.redis.get(fullKey);
if (existing) oldValue = JSON.parse(existing);
if (existing) {
oldValue = JSON.parse(existing);
}
}
const ttl = opts.ttl ?? this.defaultTTL;
if (opts.onlyIfExists) {
const result = await this.redis.set(fullKey, serialized, 'EX', ttl, 'XX');
if (!result) return oldValue;
if (!result) {
return oldValue;
}
} else if (opts.onlyIfNotExists) {
const result = await this.redis.set(fullKey, serialized, 'EX', ttl, 'NX');
if (!result) return oldValue;
if (!result) {
return oldValue;
}
} else if (opts.preserveTTL) {
const currentTTL = await this.redis.ttl(fullKey);
if (currentTTL > 0) {
@ -200,7 +206,7 @@ export class RedisCache implements CacheProvider {
}
async waitForReady(timeout = 5000): Promise<void> {
if (this.redis.status === 'ready') return;
if (this.redis.status === 'ready') {return;}
return new Promise((resolve, reject) => {
const timer = setTimeout(() => {

View file

@ -1,6 +1,6 @@
import { getLogger } from '@stock-bot/logger';
import type { ShutdownCallback, ShutdownOptions } from './types';
import { SHUTDOWN_DEFAULTS } from './constants';
import type { ShutdownCallback, ShutdownOptions } from './types';
interface CallbackEntry {
callback: ShutdownCallback;
@ -34,7 +34,7 @@ export class Shutdown {
* Register a cleanup callback
*/
onShutdown(callback: ShutdownCallback, priority: number = SHUTDOWN_DEFAULTS.MEDIUM_PRIORITY, name?: string): void {
if (this.isShuttingDown) return;
if (this.isShuttingDown) { return };
this.callbacks.push({ callback, priority, name });
}
@ -42,7 +42,7 @@ export class Shutdown {
* Initiate graceful shutdown
*/
async shutdown(): Promise<void> {
if (this.isShuttingDown) return;
if (this.isShuttingDown) { return };
this.isShuttingDown = true;
@ -71,7 +71,7 @@ export class Shutdown {
}
private setupSignalHandlers(): void {
if (this.signalHandlersRegistered) return;
if (this.signalHandlersRegistered) { return };
const signals: NodeJS.Signals[] = ['SIGTERM', 'SIGINT'];