Skip to content

Commit

Permalink
improve log message
Browse files Browse the repository at this point in the history
  • Loading branch information
devcorpio committed Feb 22, 2024
1 parent 5a0cf94 commit 480a6a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions heartbeat/monitors/wrappers/monitorstate/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func (t *Tracker) GetCurrentState(sf stdfields.StdMonitorFields, rc RetryConfig)

var loadedState *State
var err error
for i := 0; i < attempts; i++ {
var i int
for i = 0; i < attempts; i++ {
loadedState, err = t.stateLoader(sf)
if err == nil {
if loadedState != nil {
Expand All @@ -123,7 +124,7 @@ func (t *Tracker) GetCurrentState(sf stdfields.StdMonitorFields, rc RetryConfig)
time.Sleep(sleepFor)
}
if err != nil {
logp.L().Warnf("could not load prior state from elasticsearch after %d attempts, will create new state for monitor: %s", attempts, sf.ID)
logp.L().Warnf("could not load prior state from elasticsearch after %d attempts, will create new state for monitor: %s", i+1, sf.ID)
}

if loadedState != nil {
Expand Down

0 comments on commit 480a6a1

Please sign in to comment.