From ab7a2e487fe119ab35da147d0afe8c881cf22220 Mon Sep 17 00:00:00 2001
From: Gregory Salaun <legreg002@hotmail.com>
Date: Thu, 24 Oct 2024 22:06:07 +0700
Subject: [PATCH] up

---
 TCPClient.go | 8 ++++----
 spot.go      | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/TCPClient.go b/TCPClient.go
index 514db3c..65df7c8 100644
--- a/TCPClient.go
+++ b/TCPClient.go
@@ -150,10 +150,10 @@ func (c *TCPClient) ReadLine() {
 			c.Log.Info("Start receiving spots")
 		}
 
-		start := time.Now()
-		ProcessTelnetSpot(spotRe, message, c.SpotChanToFlex, c.SpotChanToHTTPServer, c.Countries)
-		elapsed := time.Since(start)
-		Log.Infof("Total time for processing spot: %s", elapsed)
+		// start := time.Now()
+		go ProcessTelnetSpot(spotRe, message, c.SpotChanToFlex, c.SpotChanToHTTPServer, c.Countries)
+		// elapsed := time.Since(start)
+		// Log.Infof("Total time for processing spot: %s", elapsed)
 
 		// Send the spot message to TCP server
 		if len(c.TCPServer.Clients) > 0 {
diff --git a/spot.go b/spot.go
index 61e13c6..068b3a2 100644
--- a/spot.go
+++ b/spot.go
@@ -5,6 +5,7 @@ import (
 	"strconv"
 	"strings"
 	"sync"
+	"time"
 
 	_ "github.com/mattn/go-sqlite3"
 )
@@ -58,6 +59,8 @@ func ProcessTelnetSpot(re *regexp.Regexp, spotRaw string, SpotChanToFlex chan Te
 		wg := new(sync.WaitGroup)
 		wg.Add(4)
 
+		start := time.Now()
+
 		go contactRepo.ListByCountry(spot.DXCC, contactsChan, wg)
 		contacts := <-contactsChan
 
@@ -71,6 +74,8 @@ func ProcessTelnetSpot(re *regexp.Regexp, spotRaw string, SpotChanToFlex chan Te
 		contactsCall := <-contactsCallChan
 
 		wg.Wait()
+		elapsed := time.Since(start)
+		Log.Infof("Checking Db took: %s", elapsed)
 
 		if len(contacts) == 0 {
 			spot.NewDXCC = true