-
Notifications
You must be signed in to change notification settings - Fork 82
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
Feature: add seconds limiter with unitest #168
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Date: Sun Aug 11 22:00:00 2024 +0800 Feature: support seconds limiter - add a fixed time window to implement the second limiter function - at the same time, documentation `doc.md` has been added to explain the feature
ddd406f
to
9e4d50a
Compare
|
||
namespace trpc::overload_control { | ||
|
||
SecondsOverloadController::SecondsOverloadController(std::string name, int64_t limit, bool is_report, |
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.
是不是只需要改造一下trpc/overload_control/flow_control模块,让他接入到trpc/overload_control/server_overload_controller.h就好了?没必要拷贝大量重复的代码
|
||
namespace trpc::overload_control { | ||
|
||
SecondsOverloadController::SecondsOverloadController(std::string name, int64_t limit, bool is_report, |
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.
是不是只需要改造一下trpc/overload_control/flow_control模块,让他接入到trpc/overload_control/server_overload_controller.h就好了?没必要拷贝大量重复的代码
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.
没理解这里的意思欸,是在trpc/overload_control/flow_control目录下面直接新建文件或者修改原有的文件吗?
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.
可以看下这个pr,我评论了一下,你看下能否按评论改造下
-Adding reuse -Managing Limiters with Maps -Formatting Documents
已经合入完成相同功能点的PR,关闭此PR |
完成了 #142 ,实现了固定窗口过载保护插件(我起的名字叫做Seconds Limiter),可以执行
bash /trpc-cpp/test_seconds_limiter.sh
启动服务端进行测试, 执行./bazel-bin/examples/helloworld/test/fiber_client --client_config=./examples/helloworld/test/conf/trpc_cpp_fiber.yaml
启动客户端进行测试,文档和注释会在之后补充。