Abhishek Kondur 1 rok temu
rodzic
commit
2aa3a02ce6
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      main.go

+ 10 - 0
main.go

@@ -168,6 +168,15 @@ func runMessageQueue(wg *sync.WaitGroup, ctx context.Context) {
 	defer wg.Done()
 	go mq.Keepalive(ctx)
 	defer mq.CloseClient()
+	go func() {
+		st := time.Second * 30
+		for {
+			time.Sleep(st)
+			logger.Log(0, "-----------> $$$$$$$ Restting MQ CONN")
+			mq.ResetCh <- struct{}{}
+			st = time.Second * 5
+		}
+	}()
 	for {
 		brokerHost, _ := servercfg.GetMessageQueueEndpoint()
 		logger.Log(0, "connecting to mq broker at", brokerHost)
@@ -179,6 +188,7 @@ func runMessageQueue(wg *sync.WaitGroup, ctx context.Context) {
 		}
 		select {
 		case <-mq.ResetCh:
+			logger.Log(0, "\n\n$$$$$$$-------> Resetting MQ----------------> \n\n")
 			mq.CloseClient()
 			time.Sleep(time.Second * 2)
 			continue