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

feat(api): add http/grpc interface rate limit #5502

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

xxo1shine
Copy link
Contributor

What does this PR do?
add http/grpc interface rate limit, refer to issue #5390

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@@ -62,7 +63,7 @@ private void addRateContainer() {

} else {
constructor = c.getConstructor();
obj = constructor.newInstance();
obj = constructor.newInstance("qps=" + QPS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this "qps" and later should use STRATEGY_PARAM_QPS in QpsStrategy

@halibobo1205 halibobo1205 added the topic: gRPC/HTTP api rpc/http related issue label Sep 19, 2023
} else {
constructor = c.getConstructor();
obj = constructor.newInstance();
obj = constructor.newInstance(QpsStrategy.DEFAULT_QPS_PARAM);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the default initial logic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@codecov-commenter
Copy link

Codecov Report

Merging #5502 (b4d1a6b) into release_v4.7.3 (c97617c) will increase coverage by 0.09%.
The diff coverage is 75.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@                 Coverage Diff                  @@
##             release_v4.7.3    #5502      +/-   ##
====================================================
+ Coverage             64.90%   65.00%   +0.09%     
- Complexity            10001    10018      +17     
====================================================
  Files                   894      894              
  Lines                 53799    53806       +7     
  Branches               5920     5921       +1     
====================================================
+ Hits                  34920    34978      +58     
+ Misses                16168    16117      -51     
  Partials               2711     2711              
Files Changed Coverage Δ
common/src/main/java/org/tron/core/Constant.java 50.00% <ø> (ø)
...e/services/ratelimiter/RateLimiterInterceptor.java 40.00% <ø> (ø)
.../ratelimiter/adapter/GlobalPreemptibleAdapter.java 100.00% <ø> (ø)
...rg/tron/core/services/http/RateLimiterServlet.java 62.96% <25.00%> (ø)
...ava/org/tron/common/parameter/CommonParameter.java 59.88% <100.00%> (+0.11%) ⬆️
.../src/main/java/org/tron/core/config/args/Args.java 60.34% <100.00%> (+0.17%) ⬆️
...ore/services/ratelimiter/strategy/QpsStrategy.java 100.00% <100.00%> (ø)

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -59,34 +55,29 @@ private void addRateContainer() {
constructor = c.getConstructor(String.class);
obj = constructor.newInstance(params);
container.add(KEY_PREFIX_HTTP, getClass().getSimpleName(), (IRateLimiter) obj);

} else {
constructor = c.getConstructor();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constructor = c.getConstructor(String.class)?

@xxo1shine xxo1shine merged commit 52283dc into tronprotocol:release_v4.7.3 Sep 20, 2023
5 checks passed
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.7.3 milestone Sep 21, 2023
@xxo1shine xxo1shine deleted the api branch May 28, 2024 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants