Skip to content

Commit

Permalink
fix heart beat loop not restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed Mar 23, 2022
1 parent 68e8d39 commit b75d2b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func runMain() error {

for {
if conf.OnWindow.Active() {
if !sendingHeartBeats {
// means pi hasnt reboot and we need to start a new heartbeat loop
sendingHeartBeats = true
go heartBeatLoop(conf.OnWindow)
}
untilEnd := conf.OnWindow.UntilEnd()
log.Printf("%s until on window ends", untilEnd)
log.Println("sleeping until end of window")
Expand Down Expand Up @@ -201,10 +206,6 @@ func runMain() error {
}
}
}
if !sendingHeartBeats {
sendingHeartBeats = true
go heartBeatLoop(conf.OnWindow)
}
time.Sleep(time.Minute * 5)
}
}
Expand Down

0 comments on commit b75d2b8

Please sign in to comment.