diff --git a/libs/core/cache/src/redis-cache.ts b/libs/core/cache/src/redis-cache.ts index f65128a..8e630cb 100644 --- a/libs/core/cache/src/redis-cache.ts +++ b/libs/core/cache/src/redis-cache.ts @@ -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 { - if (this.redis.status === 'ready') return; + if (this.redis.status === 'ready') {return;} return new Promise((resolve, reject) => { const timer = setTimeout(() => { diff --git a/libs/core/shutdown/src/shutdown.ts b/libs/core/shutdown/src/shutdown.ts index 9e9ff75..434601a 100644 --- a/libs/core/shutdown/src/shutdown.ts +++ b/libs/core/shutdown/src/shutdown.ts @@ -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 { - 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'];