Skip to content

Commit af3cac9

Browse files
committed
indexer: Remove retry logic
The retry logic in the indexer's controller is faulty in that every action that may return a timeout error (the entry path to set retry to true) will also return a Terminal state along with the timeout error. Therefore after pausing briefly in the retry statement it will then break due to the next state being Terminal. I think the correct way to fix this is to just remove the rety logic as it can also cause an empty index report to be written to the database and simplifying the code seems to be the best approach. Signed-off-by: Iain Duncan <[email protected]>
1 parent 51d8993 commit af3cac9

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

indexer/controller/controller.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ func (s *Controller) run(ctx context.Context) (err error) {
9797
continue
9898
case errors.Is(err, nil):
9999
// OK
100-
case errors.Is(err, context.DeadlineExceeded):
101-
// Either the function's internal deadline or the parent's deadline
102-
// was hit.
103-
retry = true
104100
case errors.Is(err, context.Canceled):
105101
// The parent context was canceled and the stateFunc noticed.
106102
// Continuing the loop should drop execution out of it.
@@ -122,22 +118,6 @@ func (s *Controller) run(ctx context.Context) (err error) {
122118
err = setReportErr
123119
break
124120
}
125-
if retry {
126-
t := time.NewTimer(w)
127-
select {
128-
case <-ctx.Done():
129-
case <-t.C:
130-
}
131-
t.Stop()
132-
w = jitter()
133-
retry = false
134-
// Execution is in this conditional because err ==
135-
// context.DeadlineExceeded, so reset the err value to make sure the
136-
// loop makes it back to the error handling switch above. If the
137-
// context was canceled, the loop will end there; if not, there will
138-
// be a retry.
139-
err = nil
140-
}
141121
// This if statement preserves current behaviour of not setting
142122
// currentState to Terminal when it's returned. This should be an
143123
// internal detail, but is codified in the tests (for now).

0 commit comments

Comments
 (0)