Skip to content

Commit

Permalink
Add comment explaining sleep in main loop
Browse files Browse the repository at this point in the history
  • Loading branch information
cjonesy committed Sep 12, 2024
1 parent c70b0e5 commit c2846b5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ func (w *GceMetadataWatcher) Watch(change chan interface{}) {

w.log.Error("error getting metadata",
tint.Err(err))

// Usually getMetadata opens up a connection to the metadata server
// and waits for a change. If there is an error we want to wait for a
// bit before trying again to prevent hammering the metadata server.
// Since we're in a for loop here the retrys will come VERY fast without
// this sleep.
time.Sleep(w.MetadataErrorWait)
continue
}
Expand Down

0 comments on commit c2846b5

Please sign in to comment.