mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-11-13 03:49:47 +01:00
Added base execution loop with readiness check
This commit is contained in:
+6
-8
@@ -47,8 +47,7 @@ func main() {
|
|||||||
// infinite loop
|
// infinite loop
|
||||||
for {
|
for {
|
||||||
|
|
||||||
log.Printf("Executing instruction %s", *name)
|
systemIterator(name)
|
||||||
systemIterator()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,15 +77,13 @@ func isDatabaseReady() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getNextInstruction : Retrieves next instruction from the database
|
// getNextInstruction : Retrieves next instruction from the database
|
||||||
func getNextInstruction() string {
|
func getNextInstruction(name *string) string {
|
||||||
|
log.Printf("Fetching next instruction for %s", *name)
|
||||||
return "Test Instruction Command"
|
return "Test Instruction Command"
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeInstruction(string) string {
|
func systemIterator(name *string) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func systemIterator() {
|
|
||||||
if !isSystemReady() {
|
if !isSystemReady() {
|
||||||
// Wait about 60 seconds before trying again.
|
// Wait about 60 seconds before trying again.
|
||||||
log.Printf("System not ready. Next try will be executed in 60 seconds")
|
log.Printf("System not ready. Next try will be executed in 60 seconds")
|
||||||
@@ -95,6 +92,7 @@ func systemIterator() {
|
|||||||
// Wait about 1 second before resumming operations.
|
// Wait about 1 second before resumming operations.
|
||||||
log.Printf("Next instruction will be executed 1 second")
|
log.Printf("Next instruction will be executed 1 second")
|
||||||
time.Sleep(time.Millisecond * time.Duration(1000))
|
time.Sleep(time.Millisecond * time.Duration(1000))
|
||||||
|
log.Printf("Next instruction: %s", getNextInstruction(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user