Skip to content

Commit

Permalink
Fix race condition that occurs during TestVirtualEndpoint (#2389)
Browse files Browse the repository at this point in the history
Fixes #2374
  • Loading branch information
furkansenharputlu authored and buger committed Jul 10, 2019
1 parent 211b449 commit 6f2c894
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gateway/mw_redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (m *RedisCacheMiddleware) ProcessRequest(w http.ResponseWriter, r *http.Req

// Record analytics
if !m.Spec.DoNotTrack {
go m.sh.RecordHit(r, 0, newRes.StatusCode, newRes)
m.sh.RecordHit(r, 0, newRes.StatusCode, newRes)
}

// Stop any further execution
Expand Down
2 changes: 1 addition & 1 deletion gateway/mw_virtual_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (d *VirtualEndpoint) ServeHTTPForCache(w http.ResponseWriter, r *http.Reque
copiedResponse := forceResponse(w, r, &newResponseData, d.Spec, session, false, d.Logger())

if copiedResponse != nil {
go d.sh.RecordHit(r, 0, copiedResponse.StatusCode, copiedResponse)
d.sh.RecordHit(r, 0, copiedResponse.StatusCode, copiedResponse)
}

return copiedResponse
Expand Down

0 comments on commit 6f2c894

Please sign in to comment.