From 664c64f0fdee0bafb5a49ac0f507d614a8bbf017 Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 6 Sep 2023 14:50:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=87=8D=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rabbitmq.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rabbitmq.go b/rabbitmq.go index 474e440..6d66c22 100644 --- a/rabbitmq.go +++ b/rabbitmq.go @@ -28,9 +28,13 @@ type Config struct { } // InitRabbitmq @Title 初始化rabbitmq -func InitRabbitmq(config Config) (err error) { +func InitRabbitmq(config Config) error { Rabbitmq.config = config - return getConn() + err := getConn() + if err != nil && Rabbitmq.config.ReConn { + go reConn() + } + return err } // @Title 获取连接