From 22a07a88f1ec6a9d28a328c4edb194c9457b6bc5 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Tue, 14 May 2024 11:13:29 +0800 Subject: [PATCH] Add etcd as a service discovery mechanism --- tools/check-component/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/check-component/main.go b/tools/check-component/main.go index 51daa0782..5fa84ac36 100644 --- a/tools/check-component/main.go +++ b/tools/check-component/main.go @@ -139,28 +139,28 @@ func main() { func performChecks(ctx context.Context, mongoConfig *config.Mongo, redisConfig *config.Redis, kafkaConfig *config.Kafka, minioConfig *config.Minio, discovery *config.Discovery, maxRetry int) error { checksDone := make(map[string]bool) - checks := map[string]func() error{ - "Mongo": func() error { + checks := map[string]func(ctx context.Context) error{ + "Mongo": func(ctx context.Context) error { return CheckMongo(ctx, mongoConfig) }, - "Redis": func() error { + "Redis": func(ctx context.Context) error { return CheckRedis(ctx, redisConfig) }, - "Kafka": func() error { + "Kafka": func(ctx context.Context) error { return CheckKafka(ctx, kafkaConfig) }, } if minioConfig != nil { - checks["MinIO"] = func() error { + checks["MinIO"] = func(ctx context.Context) error { return CheckMinIO(ctx, minioConfig) } } if discovery.Enable == "etcd" { - checks["Etcd"] = func() error { + checks["Etcd"] = func(ctx context.Context) error { return CheckEtcd(ctx, &discovery.Etcd) } } else if discovery.Enable == "zookeeper" { - checks["Zookeeper"] = func() error { + checks["Zookeeper"] = func(ctx context.Context) error { return CheckZookeeper(ctx, &discovery.ZooKeeper) } } @@ -169,7 +169,7 @@ func performChecks(ctx context.Context, mongoConfig *config.Mongo, redisConfig * allSuccess := true for name, check := range checks { if !checksDone[name] { - if err := check(); err != nil { + if err := check(ctx); err != nil { fmt.Printf("%s check failed: %v\n", name, err) allSuccess = false } else {