Skip to content

Commit

Permalink
optimize: removed the unused shdict metatable retrieval code
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jan 11, 2017
1 parent a73f7af commit b952fa9
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/resty/lock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local ffi_new = ffi.new
local shared = ngx.shared
local sleep = ngx.sleep
local log = ngx.log
local shdict_mt
local debug = ngx.config.debug
local setmetatable = setmetatable
local getmetatable = getmetatable
Expand Down Expand Up @@ -131,9 +130,6 @@ function _M.lock(self, key)
local ok, err = dict:add(key, true, exptime)
if ok then
cdata.key_id = ref_obj(key)
if not shdict_mt then
shdict_mt = getmetatable(dict)
end
return 0
end
if err ~= "exists" then
Expand All @@ -157,9 +153,6 @@ function _M.lock(self, key)
local ok, err = dict:add(key, true, exptime)
if ok then
cdata.key_id = ref_obj(key)
if not shdict_mt then
shdict_mt = getmetatable(dict)
end
return elapsed
end

Expand Down

0 comments on commit b952fa9

Please sign in to comment.