Skip to content

Commit

Permalink
resolver: avoid retrying fatal error
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Aug 12, 2020
1 parent 4994d45 commit 321d47c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions util/resolver/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,17 @@ func (a *dockerAuthorizer) AddResponses(ctx context.Context, responses []*http.R
if c.Scheme == auth.BearerAuth {
if err := invalidAuthorization(c, responses); err != nil {
a.handlers.delete(handler)

oldScope := ""
if handler != nil {
oldScope = strings.Join(handler.common.Scopes, " ")
}
handler = nil

// this hacky way seems to be best method to detect that error is fatal and should not be retried with a new token
if c.Parameters["error"] == "insufficient_scope" && c.Parameters["scope"] == oldScope {
return err
}
}

// reuse existing handler
Expand Down

0 comments on commit 321d47c

Please sign in to comment.