Skip to content

Commit

Permalink
fix: tweaked code according to the code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tokers committed Dec 6, 2020
1 parent 3dd0086 commit fc11d3d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion apisix/plugins/server-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ local attr_schema = {
type = "integer",
description = "server info reporting interval (unit: second)",
default = 60,
minimum = 5,
minimum = 60,
maximum = 3600,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/plugins/server-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion doc/zh-cn/plugins/server-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions t/plugin/server-info.t
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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



Expand Down

0 comments on commit fc11d3d

Please sign in to comment.