mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
refactor: improve readability of conditional statements
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user