Skip to content

Commit

Permalink
fix(collapse): fix getting response from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 committed Apr 21, 2019
1 parent 729b62d commit d01d44a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configuration/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ buckets:
headers:
"x--key": "sec"
transform:
kind: "local-meta"
kind: "noop"
rootPath: "/tmp/mort"
pathPrefix: "transforms"

Expand Down
5 changes: 3 additions & 2 deletions pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,10 @@ func (r *RequestProcessor) process(req *http.Request, obj *object.FileObject) *r

if obj.HasTransform() {
res = updateHeaders(obj, r.collapseGET(req, obj))
} else {
res = updateHeaders(obj, r.handleGET(req, obj))
}

res = updateHeaders(obj, r.handleGET(req, obj))
if res.IsCachable() && res.IsBuffered() && res.ContentLength < r.serverConfig.Cache.MaxCacheItemSize {
resCpy, err := res.Copy()
if err == nil {
Expand Down Expand Up @@ -224,7 +225,7 @@ func (r *RequestProcessor) collapseGET(req *http.Request, obj *object.FileObject
lockResult.Cancel <- true
return r.replyWithError(obj, 504, errTimeout)
default:
if cacheRes, err := r.responseCache.Get(obj); err != nil {
if cacheRes, err := r.responseCache.Get(obj); err == nil {
lockResult.Cancel <- true
return cacheRes
}
Expand Down

0 comments on commit d01d44a

Please sign in to comment.