Files
godoxy-yusing/internal/homepage/icons/fetch/route.go
yusing 4ec352f1f6 refactor(homepage/icon): check service health before fetching icons and add retry logic
The icon fetching logic now checks if the target service is healthy before
attempting to fetch icons. If the health monitor reports an unhealthy status,
the function returns HTTP 503 Service Unavailable instead of proceeding.

Additionally, the icon cache lookup now includes infinite retry logic with a
15-second backoff interval, improving resilience during transient service
outages. Previously, failed lookups would not be retried.

The `route` interface was extended with a `HealthMonitor()` method to support
the health check functionality.
2026-01-09 21:48:35 +08:00

23 lines
376 B
Go

package iconfetch
import (
"net/http"
nettypes "github.com/yusing/godoxy/internal/net/types"
"github.com/yusing/godoxy/internal/types"
"github.com/yusing/goutils/pool"
)
type route interface {
pool.Object
ProviderName() string
References() []string
TargetURL() *nettypes.URL
HealthMonitor() types.HealthMonitor
}
type httpRoute interface {
route
http.Handler
}