Skip to content

Commit

Permalink
Performance test: try to bail early
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Jan 22, 2020
1 parent e0aed2a commit 58ce455
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,5 +502,3 @@
- The cache of available clients is being reset every minute for discovery of newely added resources to a cluster. [#280](https://github.com/operator-framework/operator-sdk/pull/280)


# TODO(asmacdo) Move this up after other changes are done (to avoid merge conflicts)
- Added `blacklist` field to the `watches.yaml` for Ansible based operators. Blacklisted secondary resources will not be watched or cached.([#2374](https://github.com/operator-framework/operator-sdk/pull/2374))
11 changes: 7 additions & 4 deletions pkg/ansible/proxy/cache_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ func (c *cacheResponseHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques
break
}

// check if resource is present on request
if !r.IsResourceRequest {
// Not in skipCacheLookup for performance.
log.Info("Skipping cache lookup", "resource", r)
break
}

if c.restMapper == nil {
c.restMapper = meta.NewDefaultRESTMapper([]schema.GroupVersion{schema.GroupVersion{
Group: r.APIGroup,
Expand Down Expand Up @@ -142,10 +149,6 @@ func (c *cacheResponseHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques

// skipCacheLookup - determine if we should skip the cache lookup
func (c *cacheResponseHandler) skipCacheLookup(r *requestfactory.RequestInfo, gvk schema.GroupVersionKind, req *http.Request) bool {
// check if resource is present on request
if !r.IsResourceRequest {
return true
}

owner, err := getRequestOwnerRef(req)
if err != nil {
Expand Down

0 comments on commit 58ce455

Please sign in to comment.