update every hour at 59 minutes
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
2025-09-01 09:26:30 -06:00
parent 3c274c614b
commit d2df02b432

29
main.go
View File

@@ -69,8 +69,33 @@ func main() {
for { // Main program loop
refreshData()
log.Print("Sleeping for 6 hours...")
time.Sleep(time.Hour * 6)
// Update at 59 minutes on the hour
// Get current time
now := time.Now()
// Calculate the next time at 59 minutes
next := time.Date(
now.Year(),
now.Month(),
now.Day(),
now.Hour(),
59,
0,
0,
now.Location(),
)
// If we've already passed this hour's 59th minute, go to next hour
if !next.After(now) {
next = next.Add(time.Hour)
}
// Duration to sleep
duration := time.Until(next)
log.Printf("Sleeping until %v (%v)", next, duration)
time.Sleep(duration)
}
}