Skip to content

Commit 470dbf8

Browse files
authored
chore: add redis prefix to keepalive settings (#12955)
Signed-off-by: Nic <[email protected]>
1 parent 06f0fbc commit 470dbf8

File tree

14 files changed

+28
-28
lines changed

14 files changed

+28
-28
lines changed

apisix/plugins/limit-conn/limit-conn-redis.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function _M.incoming(self, key, commit)
5151
return red, err
5252
end
5353
local delay, incoming_err = util.incoming(self, red, key, commit)
54-
local ok, err = red:set_keepalive(conf.keepalive_timeout, conf.keepalive_pool)
54+
local ok, err = red:set_keepalive(conf.redis_keepalive_timeout, conf.redis_keepalive_pool)
5555
if not ok then
5656
core.log.error("set keepalive failed: ", err)
5757
end
@@ -72,7 +72,7 @@ local function leaving_thread(premature, self, key, req_latency, req_id)
7272
return red, err
7373
end
7474
local conn, leaving_err = util.leaving(self, red, key, req_latency, req_id)
75-
local ok, err = red:set_keepalive(conf.keepalive_timeout, conf.keepalive_pool)
75+
local ok, err = red:set_keepalive(conf.redis_keepalive_timeout, conf.redis_keepalive_pool)
7676
if not ok then
7777
core.log.error("set keepalive failed: ", err)
7878
end

apisix/plugins/limit-count/limit-count-redis.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function _M.incoming(self, key, cost)
7474
local remaining = res[1]
7575
ttl = res[2]
7676

77-
local ok, err = red:set_keepalive(conf.keepalive_timeout, conf.keepalive_pool)
77+
local ok, err = red:set_keepalive(conf.redis_keepalive_timeout, conf.redis_keepalive_pool)
7878
if not ok then
7979
return nil, err, ttl
8080
end

apisix/plugins/limit-req/limit-req-redis.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function _M.incoming(self, key, commit)
4747
end
4848

4949
local delay, incoming_err = util.incoming(self, red, key, commit)
50-
local ok, err = red:set_keepalive(conf.keepalive_timeout, conf.keepalive_pool)
50+
local ok, err = red:set_keepalive(conf.redis_keepalive_timeout, conf.redis_keepalive_pool)
5151
if not ok then
5252
core.log.error("set keepalive failed: ", err)
5353
end

apisix/utils/redis-schema.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ local policy_to_additional_properties = {
4242
redis_ssl_verify = {
4343
type = "boolean", default = false,
4444
},
45-
keepalive_timeout = {
45+
redis_keepalive_timeout = {
4646
type = "integer", minimum = 1000, default = 10000
4747
},
48-
keepalive_pool = {
48+
redis_keepalive_pool = {
4949
type = "integer", minimum = 1, default = 100
5050
}
5151
},
@@ -75,10 +75,10 @@ local policy_to_additional_properties = {
7575
redis_cluster_ssl_verify = {
7676
type = "boolean", default = false,
7777
},
78-
keepalive_timeout = {
78+
redis_keepalive_timeout = {
7979
type = "integer", minimum = 1000, default = 10000
8080
},
81-
keepalive_pool = {
81+
redis_keepalive_pool = {
8282
type = "integer", minimum = 1, default = 100
8383
}
8484
},

apisix/utils/rediscluster.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ local function new_redis_cluster(conf, dict_name)
2424
local config = {
2525
name = conf.redis_cluster_name,
2626
serv_list = {},
27-
keepalive_timeout = conf.keepalive_timeout, -- redis connection pool idle timeout
28-
keepalive_cons = conf.keepalive_pool, -- redis connection pool size
27+
keepalive_timeout = conf.redis_keepalive_timeout, -- redis connection pool idle timeout
28+
keepalive_cons = conf.redis_keepalive_pool, -- redis connection pool size
2929
connect_timeout = conf.redis_timeout,
3030
read_timeout = conf.redis_timeout,
3131
send_timeout = conf.redis_timeout,

docs/en/latest/plugins/limit-conn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ The `limit-conn` Plugin limits the rate of requests by the number of concurrent
5757
| redis_ssl_verify | boolean | False | false | | If true, verify the server SSL certificate when `policy` is `redis`. |
5858
| redis_database | integer | False | 0 | >= 0 | The database number in Redis when `policy` is `redis`. |
5959
| redis_timeout | integer | False | 1000 | [1,...] | The Redis timeout value in milliseconds when `policy` is `redis` or `redis-cluster`. |
60-
| keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
61-
| keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`.|
60+
| redis_keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
61+
| redis_keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`.|
6262
| redis_cluster_nodes | array[string] | False | | | The list of the Redis cluster nodes with at least two addresses. Required when policy is redis-cluster. |
6363
| redis_cluster_name | string | False | | | The name of the Redis cluster. Required when `policy` is `redis-cluster`. |
6464
| redis_cluster_ssl | boolean | False | false | | If true, use SSL to connect to Redis cluster when `policy` is |

docs/en/latest/plugins/limit-count.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ You may see the following rate limiting headers in the response:
6262
| redis_ssl_verify | boolean | False | false | | If true, verify the server SSL certificate when `policy` is `redis`. |
6363
| redis_database | integer | False | 0 | >= 0 | The database number in Redis when `policy` is `redis`. |
6464
| redis_timeout | integer | False | 1000 | [1,...] | The Redis timeout value in milliseconds when `policy` is `redis` or `redis-cluster`. |
65-
| keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
66-
| keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`. |
65+
| redis_keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
66+
| redis_keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`. |
6767
| redis_cluster_nodes | array[string] | False | | | The list of the Redis cluster nodes with at least two addresses. Required when policy is redis-cluster. |
6868
| redis_cluster_name | string | False | | | The name of the Redis cluster. Required when `policy` is `redis-cluster`. |
6969
| redis_cluster_ssl | boolean | False | false | | If true, use SSL to connect to Redis cluster when `policy` is `redis-cluster`. |

docs/en/latest/plugins/limit-req.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ The `limit-req` Plugin uses the [leaky bucket](https://en.wikipedia.org/wiki/Lea
5656
| redis_ssl_verify | boolean | False | false | | If true, verify the server SSL certificate when `policy` is `redis`. |
5757
| redis_database | integer | False | 0 | >= 0 | The database number in Redis when `policy` is `redis`. |
5858
| redis_timeout | integer | False | 1000 | [1,...] | The Redis timeout value in milliseconds when `policy` is `redis` or `redis-cluster`. |
59-
| keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
60-
| keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`. |
59+
| redis_keepalive_timeout | integer | False | 10000 | ≥ 1000 | Keepalive timeout in milliseconds for redis when `policy` is `redis` or `redis-cluster`. |
60+
| redis_keepalive_pool | integer | False | 100 | ≥ 1 | Keepalive pool size for redis when `policy` is `redis` or `redis-cluster`. |
6161
| redis_cluster_nodes | array[string] | False | | | The list of the Redis cluster nodes with at least two addresses. Required when policy is redis-cluster. |
6262
| redis_cluster_name | string | False | | | The name of the Redis cluster. Required when `policy` is `redis-cluster`. |
6363
| redis_cluster_ssl | boolean | False | false | | If true, use SSL to connect to Redis cluster when `policy` is |

docs/zh/latest/plugins/limit-conn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ description: limit-conn 插件通过管理并发连接来限制请求速率。
5757
| redis_ssl_verify | boolean || false | | 如果为 true,则在 `policy``redis` 时验证服务器 SSL 证书。|
5858
| redis_database | integer || 0 | >= 0 |`policy``redis` 时,Redis 中的数据库编号。|
5959
| redis_timeout | integer || 1000 | [1,...] |`policy``redis``redis-cluster` 时,Redis 超时值(以毫秒为单位)。 |
60-
| keepalive_timeout | integer || 10000 | ≥ 1000 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的空闲连接超时时间,单位为毫秒。|
61-
| keepalive_pool | integer || 100 | ≥ 1 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的连接池最大连接数。|
60+
| redis_keepalive_timeout | integer || 10000 | ≥ 1000 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的空闲连接超时时间,单位为毫秒。|
61+
| redis_keepalive_pool | integer || 100 | ≥ 1 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的连接池最大连接数。|
6262
| redis_cluster_nodes | array[string] || | | 具有至少两个地址的 Redis 群集节点列表。当 policy 为 redis-cluster 时必填。 |
6363
redis_cluster_name | string | 否 | | | | Redis 集群的名称。当 `policy``redis-cluster` 时必须使用。|
6464
| redis_cluster_ssl | boolean || false | | 如果为 `true`,当 `policy``redis-cluster`时,使用 SSL 连接 Redis 集群。|

docs/zh/latest/plugins/limit-count.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ description: limit-count 插件使用固定窗口算法,通过给定时间间
6363
| redis_ssl_verify | boolean || false | | 如果为 true,则在 `policy``redis` 时验证服务器 SSL 证书。|
6464
| redis_database | integer || 0 | >= 0 |`policy``redis` 时,Redis 中的数据库编号。|
6565
| redis_timeout | integer || 1000 | [1,...] |`policy``redis``redis-cluster` 时,Redis 超时值(以毫秒为单位)。 |
66-
| keepalive_timeout | integer || 10000 | ≥ 1000 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的空闲连接超时时间,单位为毫秒。|
67-
| keepalive_pool | integer || 100 | ≥ 1 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的连接池最大连接数。|
66+
| redis_keepalive_timeout | integer || 10000 | ≥ 1000 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的空闲连接超时时间,单位为毫秒。|
67+
| redis_keepalive_pool | integer || 100 | ≥ 1 |`policy``redis``redis-cluster` 时,与 `redis``redis-cluster` 的连接池最大连接数。|
6868
| redis_cluster_nodes | array[string] || | | 具有至少两个地址的 Redis 群集节点列表。当 policy 为 redis-cluster 时必填。 |
6969
redis_cluster_name | string | 否 | | | | Redis 集群的名称。当 `policy``redis-cluster` 时必须使用。|
7070
| redis_cluster_ssl | boolean || false | | 如果为 `true`,当 `policy``redis-cluster`时,使用 SSL 连接 Redis 集群。|

0 commit comments

Comments
 (0)