ops_auth_cache_health_handler.go 607 B

123456789101112131415161718192021
  1. package admin
  2. import (
  3. "net/http"
  4. "github.com/Wei-Shaw/sub2api/internal/pkg/response"
  5. "github.com/gin-gonic/gin"
  6. )
  7. // GetAuthCacheInvalidationHealth exposes durable outbox lag and subscriber health.
  8. func (h *OpsHandler) GetAuthCacheInvalidationHealth(c *gin.Context) {
  9. if h.opsService == nil {
  10. response.Error(c, http.StatusServiceUnavailable, "Ops service not available")
  11. return
  12. }
  13. if err := h.opsService.RequireMonitoringEnabled(c.Request.Context()); err != nil {
  14. response.ErrorFrom(c, err)
  15. return
  16. }
  17. response.Success(c, h.opsService.GetAuthCacheInvalidationHealth(c.Request.Context()))
  18. }