feat: align with upstream 1.5.9.9
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { disconnectRedis, getRedisClient, isRedisConfigured } from '~~/server/utils/redis'
|
||||
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
if (isRedisConfigured()) {
|
||||
getRedisClient().catch((error) => {
|
||||
console.error('[Redis] 初始化短期状态服务失败:', error)
|
||||
})
|
||||
} else {
|
||||
console.log('[Redis] 未配置,将使用单实例内存短期状态')
|
||||
}
|
||||
|
||||
nitroApp.hooks.hook('close', async () => {
|
||||
await disconnectRedis()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user