完善本地质量门禁与资金链路测试
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"hfb_sys/backend/internal/handler"
|
||||
)
|
||||
|
||||
func newReadinessChecks(deps Dependencies) map[string]handler.ReadinessCheck {
|
||||
return map[string]handler.ReadinessCheck{
|
||||
"mysql": func(ctx context.Context) error {
|
||||
if deps.DB == nil {
|
||||
return errors.New("mysql unavailable")
|
||||
}
|
||||
sqlDB, err := deps.DB.DB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sqlDB.PingContext(ctx)
|
||||
},
|
||||
"redis": func(ctx context.Context) error {
|
||||
if deps.Redis == nil {
|
||||
return errors.New("redis unavailable")
|
||||
}
|
||||
return deps.Redis.Ping(ctx).Err()
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user