Skip to content
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

Use gateway server.AddRoute(), The limit(MaxConns) of this route does not take effect #4097

Open
jaronnie opened this issue Apr 19, 2024 · 3 comments

Comments

@jaronnie
Copy link
Contributor

jaronnie commented Apr 19, 2024

Describe the bug
Use gateway server.AddRoute(), The limit(MaxConns) of this route does not take effect.

To Reproduce

  1. The code is
gw := gateway.MustNewServer(c.Gateway)
// gw add api routes
handler.RegisterHandlers(gw.Server, ctx)
gw.Server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/api/v1.0/health",
				Handler: HealthHandler(serverCtx),
			},
		},
	)
# MaxConns=100
# 测试 gateway addroute 的路由
hey -z 1s -c 120 -q 1 'http://localhost:8001/api/v1.0/health'
# 测试 api 文件 生成的 handler 注册到 gw server 后的路由
  1. The error is
Status code distribution both:
  [200]	120 responses

But origin gateway route take effect

Status code distribution:
  [200]	100 responses
  [503]	20 responses

Expected behavior
expect same responses. All take effect

  • origin gateway route
  • api handler register to gateway route
  • gw server.AddRoute route

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • go-zero version [1.6.4]
  • goctl version [1.6.4]
@jaronnie
Copy link
Contributor Author

@kevwan

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@kevwan

@jaronnie
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants