From 57a9ef3eed5d9b9e72f27f10395235803fb659ed Mon Sep 17 00:00:00 2001 From: Paulo Truta Date: Thu, 18 Feb 2021 23:02:31 +0000 Subject: [PATCH] Moved sleep instruction to after execution of lined task --- cmd/sysctl/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/sysctl/main.go b/cmd/sysctl/main.go index 0091c30..24c3c43 100644 --- a/cmd/sysctl/main.go +++ b/cmd/sysctl/main.go @@ -111,10 +111,8 @@ func systemIterator(name *string, tick int) { log.Printf("System not ready. Next try will be executed in 60 seconds") time.Sleep(defaultNotReadySleepTime) } else { + tasks.ExecuteSchedules(tick) - // Wait about 1 second before resumming operations. - log.Printf("Next instruction will be executed 1 second") - time.Sleep(defaultSleepTime) nextTask := tasks.GetNextTask() if nextTask.Task != "" { log.Printf("Executing task %s / Args: %s", nextTask.Task, nextTask.Args) @@ -123,6 +121,10 @@ func systemIterator(name *string, tick int) { log.Printf("No tasks to execute.") } + // Wait about 1 second before resumming operations. + log.Printf("Next instruction will be executed 1 second") + time.Sleep(defaultSleepTime) + } }