From 430e865eab0827f657b6e8202cd3f155aa032ee5 Mon Sep 17 00:00:00 2001 From: Dan Esparza Date: Wed, 13 Sep 2017 10:15:27 -0400 Subject: [PATCH] Fix: incorrect name in notifications, different reboot logic --- network/wifi.go | 7 ++++--- network/wifi_linux_arm.go | 9 +++++---- sensordata/collect_linux_arm.go | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/network/wifi.go b/network/wifi.go index 93d8059..8e31998 100644 --- a/network/wifi.go +++ b/network/wifi.go @@ -14,11 +14,12 @@ func UpdateWifiCredentials(ssid, password string) error { // RebootMachine calls sync and reboots the machine func RebootMachine() { - log.Println("[INFO] Rebooting...") + go func() { + log.Println("[INFO] Rebooting...") + }() // Wait before exiting, in order to give our parent enough time to finish - countdownBeforeExit := time.NewTimer(time.Second * 3) - <-countdownBeforeExit.C + time.Sleep(3 * time.Second) log.Println("[WARN] Not running on Linux/ARM, so not rebooting") } diff --git a/network/wifi_linux_arm.go b/network/wifi_linux_arm.go index 8a01859..2a1e61d 100644 --- a/network/wifi_linux_arm.go +++ b/network/wifi_linux_arm.go @@ -32,12 +32,13 @@ func UpdateWifiCredentials(ssid, password string) error { // RebootMachine calls sync and reboots the machine func RebootMachine() { - log.Println("[INFO] Rebooting...") - syscall.Sync() + go func() { + log.Println("[INFO] Rebooting...") + syscall.Sync() + }() // Wait before exiting, in order to give our parent enough time to finish - countdownBeforeExit := time.NewTimer(time.Second * 3) - <-countdownBeforeExit.C + time.Sleep(3 * time.Second) syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) } diff --git a/sensordata/collect_linux_arm.go b/sensordata/collect_linux_arm.go index 552e66e..33cf1bd 100644 --- a/sensordata/collect_linux_arm.go +++ b/sensordata/collect_linux_arm.go @@ -280,7 +280,7 @@ func sendPushoverNotification(c data.ConfigDB, runningTime int) error { // Create a new client and push a message pushClient := pushover.New(pushAPIkey.Value) recipient := pushover.NewRecipient(pushTo.Value) - message := pushover.NewMessage(fmt.Sprintf("%v has finished running. It ran for about %v minutes", applianceName, runningTime)) + message := pushover.NewMessage(fmt.Sprintf("%s has finished running. It ran for about %v minutes", applianceName.Value, runningTime)) message.Sound = "bike" _, err := pushClient.SendMessage(message, recipient) if err != nil {