From 1e3bfd73927ddaefa130ecaee5da8c8be1f48ad3 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Wed, 30 Mar 2022 17:55:28 +0700 Subject: [PATCH] [Update] --- natsio.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/natsio.go b/natsio.go index 33bdbb2..120828f 100644 --- a/natsio.go +++ b/natsio.go @@ -3,6 +3,7 @@ package natsio import ( "errors" "fmt" + "time" "github.com/logrusorgru/aurora" "github.com/nats-io/nats.go" @@ -32,6 +33,8 @@ func Connect(cfg Config) error { // Connect options opts := make([]nats.Option, 0) + opts = append(opts, nats.Timeout(1*time.Minute)) + // Has authentication if cfg.User != "" { opts = append(opts, nats.UserInfo(cfg.User, cfg.Password))