Skip to content

Commit

Permalink
state: abort list operation on context cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Jan 26, 2022
1 parent dca8923 commit cb57579
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions state/dsstate/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ func (st *State) List(ctx context.Context) ([]*api.Pin, error) {

total := 0
for r := range results.Next() {
// Abort if we shutdown.
select {
case <-ctx.Done():
return nil, ctx.Err()
default:
}
if r.Error != nil {
logger.Errorf("error in query result: %s", r.Error)
return pins, r.Error
Expand Down

0 comments on commit cb57579

Please sign in to comment.