系统优化

This commit is contained in:
hahwu 2025-03-19 17:42:49 +08:00
parent c3798e7a29
commit 13eb99f410

View File

@ -14,7 +14,7 @@ var KafkaMod *kafka.Conn
var topic string
const (
HOST = "kafka-server:9092"
HOST = "kafka-server"
PORT = "9092"
)
@ -34,6 +34,7 @@ func init() {
}
for _, p := range Partitions {
if p.Leader.Host == HOST {
log.Debug("Kafka connected partition :%v", p)
conn, err := kafka.DialLeader(context.Background(), "tcp", fmt.Sprintf("%s:%s", HOST, PORT), topic, p.ID)
if err != nil {
log.Fatal("kafka.DialLeader err: %v", err)