Skip to content

Commit

Permalink
fix(mlcache) return nil from cb nil after mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Apr 26, 2017
1 parent 17cd293 commit 591be2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/resty/mlcache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,16 @@ function _M:get(key, opts, cb, ...)

-- check for another worker's success at running the callback

data = shmlru_get(self, key, ttl, neg_ttl)
data, err = shmlru_get(self, key, ttl, neg_ttl)
if err then
return unlock_and_ret(lock, nil, err)
end

if data then
if data == CACHE_MISS_SENTINEL_LRU then
return unlock_and_ret(lock, nil)
end

return unlock_and_ret(lock, data)
end

Expand Down

0 comments on commit 591be2b

Please sign in to comment.