Skip to content

Commit

Permalink
set a one hour buffer for waking up nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rawdaGastan committed Oct 29, 2024
1 parent 7c659bb commit 2e91294
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions farmerbot/internal/farmerbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ func (f *FarmerBot) shouldWakeUp(ctx context.Context, node *node, roundStart tim
}

lastTimeNodeUpdatedAt := time.Unix(proxyNode.UpdatedAt, 0)
if time.Since(lastTimeNodeUpdatedAt) > 24*time.Hour {
// if the last time the node was awake was before 24 hours ago
if time.Since(lastTimeNodeUpdatedAt) > 23*time.Hour {
// if the last time the node was awake was before 23 hours ago (One hour to account for DST transitions)
log.Warn().Uint32("nodeID", uint32(node.ID)).Msgf("Node didn't wake up since %v hours", math.Floor(time.Since(lastTimeNodeUpdatedAt).Hours()))
log.Info().Uint32("nodeID", uint32(node.ID)).Msg("Urgent wake up")
node.lastTimePeriodicWakeUp = time.Now()
Expand Down

0 comments on commit 2e91294

Please # to comment.