-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow to set custom timeout for route #4340
Conversation
apisix/balancer.lua
Outdated
@@ -136,8 +136,18 @@ end | |||
-- set_balancer_opts will be called in balancer phase and before any tries | |||
local function set_balancer_opts(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pass route directly:
Line 247 in 09e2983
function _M.run(route, ctx) |
apisix/schema_def.lua
Outdated
@@ -491,6 +491,15 @@ _M.route = { | |||
minItems = 1, | |||
uniqueItems = true, | |||
}, | |||
timeout = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to exact the timeout
to a separate schema.
|
||
|
||
|
||
=== TEST 18: valid route with timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add test to t/node/timeout-upstream.t
apisix/schema_def.lua
Outdated
@@ -491,6 +491,15 @@ _M.route = { | |||
minItems = 1, | |||
uniqueItems = true, | |||
}, | |||
upstream_timeout = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May abstract the timeout schema so it can be reused by route and upstream schema.
docs/en/latest/admin-api.md
Outdated
@@ -88,6 +88,7 @@ Note: When the `Admin API` is enabled, it will occupy the API prefixed with `/ap | |||
| script | False | Script | See [Script](architecture-design/script.md) for more | | | |||
| upstream | False | Upstream | Enabled Upstream configuration, see [Upstream](architecture-design/upstream.md) for more | | | |||
| upstream_id | False | Upstream | Enabled upstream id, see [Upstream](architecture-design/upstream.md) for more | | | |||
| upstream_timeout | False | Upstream | Set the upstream timeout for connection, sending and receiving messages of the route. This option will overwrite the [timeout](#upstream) option which set in upstream configuration. | {"connect": 3, "send": 3, "read": 3} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| upstream_timeout | False | Upstream | Set the upstream timeout for connection, sending and receiving messages of the route. This option will overwrite the [timeout](#upstream) option which set in upstream configuration. | {"connect": 3, "send": 3, "read": 3} | | |
| upstream_timeout | False | Upstream | Set the upstream timeout for connecting, sending and receiving messages of the route. This option will overwrite the [timeout](#upstream) option which set in upstream configuration. | {"connect": 3, "send": 3, "read": 3} | |
t/admin/routes2.t
Outdated
|
||
|
||
|
||
=== TEST 18: valid route with upstream_timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need further test cases to cover the usage of upstream_timeout
.
What this PR does / why we need it:
Add optional upstream_timeout option for the route.
#4258
Pre-submission checklist: