From 707235115ce5eabe6420cd926923374006d21185 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 7 May 2019 13:37:49 +0200 Subject: [PATCH] Execute first and sleep, not the other way --- pkg/processing/update_active_clients.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/processing/update_active_clients.go b/pkg/processing/update_active_clients.go index 293dada..59ae581 100644 --- a/pkg/processing/update_active_clients.go +++ b/pkg/processing/update_active_clients.go @@ -26,8 +26,6 @@ import ( // UpdateActiveClients counts all clients and sends the number to the server. Meant to run inside a goroutine. func UpdateActiveClients() { for { - time.Sleep(config.UpdateSecondsInterval * time.Second) - clients := ParseCSVDumps(viper.GetString("daemon.csvlocation")) var activeClients int64 @@ -40,5 +38,7 @@ func UpdateActiveClients() { ActiveClients <- activeClients //fmt.Println("Active Clients:", activeClients) //fmt.Println("Total Clients:", len(clients)) + + time.Sleep(config.UpdateSecondsInterval * time.Second) } }