添加Health健康检查端点
This commit is contained in:
@@ -63,6 +63,17 @@ const cache = {
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
},
|
||||
|
||||
async checkHealth() {
|
||||
if (!redis) return { status: 'down', error: 'Valkey client not initialized' };
|
||||
try {
|
||||
const result = await redis.ping();
|
||||
if (result === 'PONG') return { status: 'up' };
|
||||
return { status: 'down', error: 'Invalid ping response' };
|
||||
} catch (e) {
|
||||
return { status: 'down', error: e.message };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user