Add retry mechanism to mongoDB, Redis, Kafka

This commit is contained in:
plutoyty
2023-07-12 20:21:52 +08:00
parent 40b26f9a2f
commit d41f2a7aef
3 changed files with 47 additions and 21 deletions
+6
View File
@@ -27,4 +27,10 @@ func TestNewRedis(t *testing.T) {
fmt.Println("config load error")
return
}
redis, err := NewRedis()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(redis)
}
+3
View File
@@ -76,6 +76,9 @@ func NewKafkaProducer(addr []string, topic string) *Producer {
//}
time.Sleep(time.Duration(1) * time.Second)
}
if err != nil {
panic(err.Error())
}
p.producer = producer
return &p
}