diff --git a/rabbitmq.go b/rabbitmq.go index 442f6da..9a1de46 100644 --- a/rabbitmq.go +++ b/rabbitmq.go @@ -31,6 +31,7 @@ func (r *rabbitmq) Publish(exchangeName, msg string, delay ...int64) error { if err != nil { return err } + defer ch.Close() header := amqp.Table{} if len(delay) > 0 && delay[0] > 0 { header["x-delay"] = delay[0] * 1000