rabbitmq: dial with timeout #150

Merged
andriinikitin merged 1 commits from rabbitmq-timeout into main 2026-03-03 09:35:04 +01:00

View File

@@ -92,10 +92,13 @@ func ConnectToExchangeForPublish(host, username, password string) {
auth = username + ":" + password + "@"
}
connection, err := rabbitmq.DialTLS("amqps://"+auth+host, &tls.Config{
ServerName: host,
connection, err := rabbitmq.DialConfig("amqps://"+auth+host, rabbitmq.Config{
Dial: rabbitmq.DefaultDial(10 * time.Second),
TLSClientConfig: &tls.Config{
ServerName: host,
},
})
failOnError(err, "Cannot connect to rabbit.opensuse.org")
failOnError(err, "Cannot connect to "+host)
defer connection.Close()
ch, err := connection.Channel()