Skip to content

Commit

Permalink
chore: don't implement "server_version" twice (apache#8131)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander authored and Liu-Junlin committed Nov 4, 2022
1 parent c65e6cc commit a55e8ef
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions apisix/core/config_etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -716,32 +716,17 @@ function _M.fetch_created_obj(key)
end


local function read_etcd_version(etcd_cli)
if not etcd_cli then
return nil, "not inited"
end

local data, err = etcd_cli:version()
if not data then
return nil, err
end

local body = data.body
if type(body) ~= "table" then
return nil, "failed to read response body when try to fetch etcd "
.. "version"
end

return body
end


function _M.server_version(self)
if not self.running then
return nil, "stopped"
end

return read_etcd_version(self.etcd_cli)
local res, err = etcd_apisix.server_version()
if not res then
return nil, err
end

return res.body
end


Expand Down

0 comments on commit a55e8ef

Please sign in to comment.