diff --git a/apisix/plugins/server-info.lua b/apisix/plugins/server-info.lua index 36dffdcd6b9d..e7dcb913fe2f 100644 --- a/apisix/plugins/server-info.lua +++ b/apisix/plugins/server-info.lua @@ -36,7 +36,8 @@ local attr_schema = { type = "integer", description = "server info reporting interval (unit: second)", default = 60, - minimum = 5, + minimum = 60, + maximum = 3600, } } } diff --git a/doc/plugins/server-info.md b/doc/plugins/server-info.md index 9bf2fb573af3..6a64294ac77c 100644 --- a/doc/plugins/server-info.md +++ b/doc/plugins/server-info.md @@ -78,7 +78,7 @@ plugin_attr: ## Test Plugin ```bash -curl http://127.0.0.1:9080/apisix/admin/server_info -s | jq +curl http://127.0.0.1:9080/apisix/server_info -s | jq { "up_time": 5, "last_report_time": 1606551536, diff --git a/doc/zh-cn/plugins/server-info.md b/doc/zh-cn/plugins/server-info.md index fac9c2c44f35..4d68200f970b 100644 --- a/doc/zh-cn/plugins/server-info.md +++ b/doc/zh-cn/plugins/server-info.md @@ -78,7 +78,7 @@ plugin_attr: ## 测试插件 ```bash -curl http://127.0.0.1:9080/apisix/admin/server_info -s | jq +curl http://127.0.0.1:9080/apisix/server_info -s | jq { "up_time": 5, "last_report_time": 1606551536, diff --git a/t/plugin/server-info.t b/t/plugin/server-info.t index 061ea90f92a1..74a010e70c83 100644 --- a/t/plugin/server-info.t +++ b/t/plugin/server-info.t @@ -32,12 +32,10 @@ plugins: - server-info plugin_attr: server-info: - report_interval: 5 + report_interval: 60 --- config location /t { content_by_lua_block { - -- let the server info to be reported - ngx.sleep(5.1) local json_decode = require("cjson.safe").decode local t = require("lib.test_admin").test local code, _, body = t('/apisix/server_info', ngx.HTTP_GET) @@ -67,11 +65,10 @@ last_report_time: \d+ up_time: \d+ version: [\d\.]+ $} ---- timeout: 5.5 --- no_error_log [error] --- error_log -timer created to report server info, interval: 5 +timer created to report server info, interval: 60