diff --git a/SPMS.API/Controllers/PublicController.cs b/SPMS.API/Controllers/PublicController.cs index 28dfaea..c5521f1 100644 --- a/SPMS.API/Controllers/PublicController.cs +++ b/SPMS.API/Controllers/PublicController.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Swashbuckle.AspNetCore.Annotations; using SPMS.Domain.Common; using SPMS.Infrastructure; +using SPMS.Infrastructure.Caching; using SPMS.Infrastructure.Messaging; namespace SPMS.API.Controllers; @@ -15,15 +16,18 @@ namespace SPMS.API.Controllers; public class PublicController : ControllerBase { private readonly AppDbContext _dbContext; + private readonly RedisConnection _redisConnection; private readonly RabbitMQConnection _rabbitConnection; private readonly RabbitMQInitializer _rabbitInitializer; public PublicController( AppDbContext dbContext, + RedisConnection redisConnection, RabbitMQConnection rabbitConnection, RabbitMQInitializer rabbitInitializer) { _dbContext = dbContext; + _redisConnection = redisConnection; _rabbitConnection = rabbitConnection; _rabbitInitializer = rabbitInitializer; } @@ -47,8 +51,18 @@ public class PublicController : ControllerBase allHealthy = false; } - // 2. Redis 연결 확인 (Phase 3-2에서 구현 예정) - checks["redis"] = new { status = "not_configured" }; + // 2. Redis 연결 확인 + try + { + var db = await _redisConnection.GetDatabaseAsync(); + var pong = await db.PingAsync(); + checks["redis"] = new { status = "healthy", latency = $"{pong.TotalMilliseconds:F1}ms" }; + } + catch (Exception ex) + { + checks["redis"] = new { status = "unhealthy", error = ex.Message }; + allHealthy = false; + } // 3. RabbitMQ 연결 확인 var rabbitConnected = _rabbitConnection.IsConnected;