Skip to content

Commit

Permalink
Merge pull request #67024 from juanvallejo/jvallejo/add-cancel-req-di…
Browse files Browse the repository at this point in the history
…scovery-rt

Automatic merge from submit-queue (batch tested with PRs 66958, 67024). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add CancelRequest to discovery round-tripper

**Release note**:
```release-note
NONE
```

Make discovery roundtripper implement the RequestCanceler interface

cc @deads2k

Kubernetes-commit: a945b5d9281ac5cba5e4a2976a0747592c0cff87
  • Loading branch information
k8s-publishing-bot committed Aug 6, 2018
2 parents 02384db + 12e8bc7 commit bdfc4cf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 51 deletions.
102 changes: 51 additions & 51 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions discovery/round_tripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net/http"
"path/filepath"

"github.com/golang/glog"
"github.com/gregjones/httpcache"
"github.com/gregjones/httpcache/diskcache"
"github.com/peterbourgon/diskv"
Expand Down Expand Up @@ -47,4 +48,15 @@ func (rt *cacheRoundTripper) RoundTrip(req *http.Request) (*http.Response, error
return rt.rt.RoundTrip(req)
}

func (rt *cacheRoundTripper) CancelRequest(req *http.Request) {
type canceler interface {
CancelRequest(*http.Request)
}
if cr, ok := rt.rt.Transport.(canceler); ok {
cr.CancelRequest(req)
} else {
glog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport)
}
}

func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }

0 comments on commit bdfc4cf

Please sign in to comment.