diff --git a/src/services/unifiedClaudeScheduler.js b/src/services/unifiedClaudeScheduler.js index 584398ee..0870ac52 100644 --- a/src/services/unifiedClaudeScheduler.js +++ b/src/services/unifiedClaudeScheduler.js @@ -827,15 +827,21 @@ class UnifiedClaudeScheduler { const remainingTTL = await client.ttl(key) // -2: key 不存在;-1: 无过期时间 - if (remainingTTL === -2) return false - if (remainingTTL === -1) return true + if (remainingTTL === -2) { + return false + } + if (remainingTTL === -1) { + return true + } const appConfig = require('../../config/config') const ttlHours = appConfig.session?.stickyTtlHours || 1 const renewalThresholdMinutes = appConfig.session?.renewalThresholdMinutes || 0 // 阈值为0则不续期 - if (!renewalThresholdMinutes) return true + if (!renewalThresholdMinutes) { + return true + } const fullTTL = Math.max(1, Math.floor(ttlHours * 60 * 60)) const threshold = Math.max(0, Math.floor(renewalThresholdMinutes * 60)) diff --git a/src/services/unifiedGeminiScheduler.js b/src/services/unifiedGeminiScheduler.js index 890803a9..88f793bd 100644 --- a/src/services/unifiedGeminiScheduler.js +++ b/src/services/unifiedGeminiScheduler.js @@ -305,13 +305,19 @@ class UnifiedGeminiScheduler { const key = `${this.SESSION_MAPPING_PREFIX}${sessionHash}` const remainingTTL = await client.ttl(key) - if (remainingTTL === -2) return false - if (remainingTTL === -1) return true + if (remainingTTL === -2) { + return false + } + if (remainingTTL === -1) { + return true + } const appConfig = require('../../config/config') const ttlHours = appConfig.session?.stickyTtlHours || 1 const renewalThresholdMinutes = appConfig.session?.renewalThresholdMinutes || 0 - if (!renewalThresholdMinutes) return true + if (!renewalThresholdMinutes) { + return true + } const fullTTL = Math.max(1, Math.floor(ttlHours * 60 * 60)) const threshold = Math.max(0, Math.floor(renewalThresholdMinutes * 60)) diff --git a/src/services/unifiedOpenAIScheduler.js b/src/services/unifiedOpenAIScheduler.js index ddc691be..2578afef 100644 --- a/src/services/unifiedOpenAIScheduler.js +++ b/src/services/unifiedOpenAIScheduler.js @@ -311,13 +311,19 @@ class UnifiedOpenAIScheduler { const key = `${this.SESSION_MAPPING_PREFIX}${sessionHash}` const remainingTTL = await client.ttl(key) - if (remainingTTL === -2) return false - if (remainingTTL === -1) return true + if (remainingTTL === -2) { + return false + } + if (remainingTTL === -1) { + return true + } const appConfig = require('../../config/config') const ttlHours = appConfig.session?.stickyTtlHours || 1 const renewalThresholdMinutes = appConfig.session?.renewalThresholdMinutes || 0 - if (!renewalThresholdMinutes) return true + if (!renewalThresholdMinutes) { + return true + } const fullTTL = Math.max(1, Math.floor(ttlHours * 60 * 60)) const threshold = Math.max(0, Math.floor(renewalThresholdMinutes * 60))