pintracker: clean exit during recover
Shutting down the cluster while a recover operation is ongoing resulted in each remaining pin in the recover loop producing an error in the logs, as the loop kept going even though compontents were already shutdown. With 8 million items, this meant a lot of log messages, and a shutdown delay that forced the killing of the process in most cases. The recover loop now exits when the component's context is cancelled.
This commit is contained in:
parent
7e85d90bae
commit
67eeb45798
|
@ -424,11 +424,19 @@ func (spt *Tracker) RecoverAll(ctx context.Context) ([]*api.PinInfo, error) {
|
|||
statuses := spt.StatusAll(ctx, api.TrackerStatusUndefined)
|
||||
resp := make([]*api.PinInfo, 0)
|
||||
for _, st := range statuses {
|
||||
r, err := spt.recoverWithPinInfo(ctx, st)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
// Break out if we shutdown. We might be going through
|
||||
// a very long list of statuses.
|
||||
select {
|
||||
case <-spt.ctx.Done():
|
||||
return nil, spt.ctx.Err()
|
||||
default:
|
||||
r, err := spt.recoverWithPinInfo(ctx, st)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
resp = append(resp, r)
|
||||
}
|
||||
resp = append(resp, r)
|
||||
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user