[VOL-5402]-VGC all fixes till date from jan 2024

Change-Id: I2857e0ef9b1829a28c6e3ad04da96b826cb900b6
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/internal/pkg/application/timer.go b/internal/pkg/application/timer.go
index 42b16d8..7ad35c3 100644
--- a/internal/pkg/application/timer.go
+++ b/internal/pkg/application/timer.go
@@ -17,6 +17,7 @@
 
 import (
 	"context"
+	"sync"
 	"time"
 	"voltha-go-controller/log"
 )
@@ -34,7 +35,7 @@
 	pendingPoolTimer: false,
 }
 
-var timerChannels = make(map[TimerType](chan bool))
+var timerChannels = sync.Map{}
 
 // TimerCfg structure
 type TimerCfg struct {
@@ -49,7 +50,8 @@
 		return
 	}
 	timerMap[timerType] = true
-	timerChannels[timerType] = make(chan bool)
+	ch := make(chan bool)
+	timerChannels.Store(timerType, ch)
 	for {
 		select {
 		case <-time.After(cfg.tick):
@@ -59,7 +61,7 @@
 			case pendingPoolTimer:
 				va.removeExpiredGroups(cntx)
 			}
-		case <-timerChannels[timerType]:
+		case <-ch:
 			return
 		}
 	}
@@ -67,7 +69,11 @@
 
 // StopTimer to stop timers
 func StopTimer() {
-	for _, ch := range timerChannels {
+	timerChannels.Range(func(key, value interface{}) bool {
+		ch := value.(chan bool)
 		ch <- true
-	}
+		/* Range calls function sequentially for each key and value present in the map.
+		If function returns false, range stops the iteration. */
+		return true
+	})
 }