spacewander commented on a change in pull request #2740:
URL: https://github.com/apache/apisix/pull/2740#discussion_r523703474
##########
File path: apisix/admin/consumers.lua
##########
@@ -76,6 +77,19 @@ function _M.put(consumer_name, conf)
local key = "/consumers/" .. consumer_name
core.log.info("key: ", key)
+
+ local res, err = core.etcd.get(key)
+ if not res or (res.status ~= 200 and res.status ~= 404) then
+ core.log.error("failed to get consumer[", key, "] from etcd: ", err or
res.status)
+ return 500, {error_msg = err}
+ end
+
+ if res.status == 404 then
+ utils.inject_timestamp(conf)
+ else
+ utils.inject_timestamp(conf, res.body)
+ end
+
Review comment:
@nic-chen
Changed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]