Skip to content

Commit

Permalink
fix: caching deadline duration
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxu19830126 committed Jan 12, 2019
1 parent db5ff83 commit 8542596
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/proxy/filter_caching.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ func (f *CachingFilter) Post(c filter.Context) (statusCode int, err error) {
}

f.cache.Add(id, genCachedValue(c))
f.tw.Schedule(time.Second*time.Duration(c.DispatchNode().Cache.Deadline),
f.removeCache, id)
if c.DispatchNode().Cache.Deadline > 0 {
f.tw.Schedule(time.Duration(c.DispatchNode().Cache.Deadline),
f.removeCache, id)
}

return f.BaseFilter.Post(c)
}

Expand Down

0 comments on commit 8542596

Please sign in to comment.