Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

53
pkg/health/redis.go Normal file
View File

@@ -0,0 +1,53 @@
package health
import (
"context"
"fiskerinc.com/modules/redis"
"fiskerinc.com/modules/redisv2"
)
type RedisHealth struct {
pool redis.ClientPoolInterface
}
func NewRedisHealth(pool redis.ClientPoolInterface) *RedisHealth {
return &RedisHealth{
pool: pool,
}
}
func (h *RedisHealth) Check(ctx context.Context) error {
client := h.pool.GetFromPool()
defer client.Close()
return client.Ping()
}
func (h *RedisHealth) RedisStatus(system *System) {
stats := h.pool.GetPool().Stats()
system.RedisStats = &stats
}
type RedisHealthV2 struct {
redisClient redisv2.ClientInterface
}
func NewRedisHealthV2(redisClient redisv2.ClientInterface) *RedisHealthV2 {
return &RedisHealthV2{
redisClient: redisClient,
}
}
func (h *RedisHealthV2) Check(ctx context.Context) error {
return h.redisClient.Ping()
}
func (h *RedisHealthV2) RedisStatus(system *System) {
// Im not so sure what
// stats := h.redisClient.GetClient().PoolStats()
system.RedisStats = nil
}