Skip to content

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

Merged
xxo1shine merged 2 commits intotronprotocol:release_v4.7.3from
xxo1shine:api
Sep 20, 2023
Merged

feat(api): add http/grpc interface rate limit#5502
xxo1shine merged 2 commits intotronprotocol:release_v4.7.3from
xxo1shine:api

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

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

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:api rpc/http related issue label Sep 19, 2023
@xxo1shine xxo1shine force-pushed the api branch 6 times, most recently from ed01b09 to 4f9b768 Compare September 19, 2023 07:36
} 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

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:api rpc/http related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants