Browse Source

Fix missing defers

Rod Hynes 2 months ago
parent
commit
2509e7e567
1 changed files with 2 additions and 2 deletions
  1. 2 2
      psiphon/server/services.go

+ 2 - 2
psiphon/server/services.go

@@ -221,7 +221,7 @@ func RunServices(configJSON []byte) (retErr error) {
 	if config.RunLoadMonitor() {
 		waitGroup.Add(1)
 		go func() {
-			waitGroup.Done()
+			defer waitGroup.Done()
 			ticker := time.NewTicker(time.Duration(config.LoadMonitorPeriodSeconds) * time.Second)
 			defer ticker.Stop()
 
@@ -301,7 +301,7 @@ func RunServices(configJSON []byte) (retErr error) {
 	if config.RunPeriodicGarbageCollection() {
 		waitGroup.Add(1)
 		go func() {
-			waitGroup.Done()
+			defer waitGroup.Done()
 			ticker := time.NewTicker(config.periodicGarbageCollection)
 			defer ticker.Stop()
 			for {