Skip to content

Commit be4bef3

Browse files
author
Gabriel Monroy
committed
fix(state): ignore intermittent timeouts when polling for UnitState
1 parent 684d800 commit be4bef3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

backend/fleet/state.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fleet
33
import (
44
"errors"
55
"fmt"
6+
"strings"
67
"sync"
78
"time"
89

@@ -157,10 +158,13 @@ func printUnitSubState(name string, outchan chan *schema.Unit, errchan chan erro
157158
// continue processing if error channel closed
158159
if err == nil {
159160
continue
161+
} else if strings.Contains(err.Error(), "timeout reached") {
162+
// ignore intermittent timeout errors
163+
continue
160164
}
161165
return err
162166
}
163-
time.Sleep(200 * time.Millisecond)
167+
time.Sleep(1000 * time.Millisecond)
164168
}
165169
}
166170

@@ -191,9 +195,12 @@ func printUnitState(name string, outchan chan *schema.Unit, errchan chan error)
191195
// continue processing if error channel closed
192196
if err == nil {
193197
continue
198+
} else if strings.Contains(err.Error(), "timeout reached") {
199+
// ignore intermittent timeout errors
200+
continue
194201
}
195202
return err
196203
}
197-
time.Sleep(200 * time.Millisecond)
204+
time.Sleep(1000 * time.Millisecond)
198205
}
199206
}

0 commit comments

Comments
 (0)