This is an automated email from the ASF dual-hosted git repository.
membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 671d184 bugfix: we didn't keep the create_time correctly (#2760)
671d184 is described below
commit 671d184ceb0e5329babcbc3f936282bc3bf2aac1
Author: 罗泽轩 <[email protected]>
AuthorDate: Tue Nov 17 18:39:28 2020 +0800
bugfix: we didn't keep the create_time correctly (#2760)
---
apisix/admin/utils.lua | 8 ++++----
t/admin/consumers.t | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/apisix/admin/utils.lua b/apisix/admin/utils.lua
index 4c0694a..df44323 100644
--- a/apisix/admin/utils.lua
+++ b/apisix/admin/utils.lua
@@ -25,11 +25,11 @@ local function inject_timestamp(conf, prev_conf, patch_conf)
if not conf.create_time then
if prev_conf and prev_conf.node.value.create_time then
conf.create_time = prev_conf.node.value.create_time
+ else
+ -- As we don't know existent data's create_time, we have to pretend
+ -- they are created now.
+ conf.create_time = ngx_time()
end
-
- -- As we don't know existent data's create_time, we have to pretend
- -- they are created now.
- conf.create_time = ngx_time()
end
-- For PATCH request, the modification is passed as 'patch_conf'
diff --git a/t/admin/consumers.t b/t/admin/consumers.t
index 2e48225..2f012e3 100644
--- a/t/admin/consumers.t
+++ b/t/admin/consumers.t
@@ -72,6 +72,7 @@ passed
assert(prev_create_time ~= nil, "create_time is nil")
local update_time = res.body.node.value.update_time
assert(update_time ~= nil, "update_time is nil")
+ ngx.sleep(1)
local code, body = t('/apisix/admin/consumers',
ngx.HTTP_PUT,