Skip to content

Conversation

@mxsm
Copy link
Member

@mxsm mxsm commented Mar 8, 2023

Make sure set the target branch to develop

What is the purpose of the change

fix #6290

Brief changelog

  • Optimize LatencyFaultToleranceImpl#updateFaultItem method

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

old.setStartTimestamp(System.currentTimeMillis() + notAvailableDuration);
}
} else {
FaultItem old = this.faultItemTable.putIfAbsent(name, new FaultItem(name, currentLatency, System.currentTimeMillis() + notAvailableDuration));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe computeIfAbsent is more suitable for reducing extra object creation.

Copy link
Member Author

Choose a reason for hiding this comment

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

@drpmma thanks for you suggestion. I will fix it and resubmit later

@mxsm mxsm requested a review from drpmma March 9, 2023 03:02
@codecov-commenter
Copy link

Codecov Report

Merging #6291 (6783edd) into develop (9e0fb1b) will increase coverage by 0.02%.
The diff coverage is 68.18%.

@@              Coverage Diff              @@
##             develop    #6291      +/-   ##
=============================================
+ Coverage      43.12%   43.15%   +0.02%     
- Complexity      8847     8856       +9     
=============================================
  Files           1095     1094       -1     
  Lines          77279    77247      -32     
  Branches       10082    10081       -1     
=============================================
+ Hits           33324    33333       +9     
+ Misses         39782    39745      -37     
+ Partials        4173     4169       -4     
Impacted Files Coverage Δ
.../org/apache/rocketmq/common/utils/ThreadUtils.java 0.00% <0.00%> (ø)
...mq/client/impl/producer/DefaultMQProducerImpl.java 46.03% <25.00%> (-0.20%) ⬇️
...ketmq/client/impl/consumer/PullMessageService.java 51.56% <66.66%> (+2.33%) ⬆️
...etmq/client/latency/LatencyFaultToleranceImpl.java 50.66% <88.88%> (+1.31%) ⬆️
...e/rocketmq/broker/topic/TopicRouteInfoManager.java 17.79% <100.00%> (-0.70%) ⬇️
...ent/impl/consumer/DefaultLitePullConsumerImpl.java 69.18% <100.00%> (+2.26%) ⬆️
...e/rocketmq/remoting/netty/NettyRemotingClient.java 39.69% <100.00%> (-0.95%) ⬇️
...he/rocketmq/controller/impl/DLedgerController.java 65.96% <0.00%> (-3.15%) ⬇️
...etmq/namesrv/processor/ClientRequestProcessor.java 76.31% <0.00%> (-2.64%) ⬇️
...ache/rocketmq/store/AllocateMappedFileService.java 39.28% <0.00%> (-2.39%) ⬇️
... and 28 more

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

Copy link
Contributor

@drpmma drpmma left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link

This PR is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR.

@github-actions github-actions bot added the stale label Mar 10, 2024
@github-actions
Copy link

This PR was closed because it has been inactive for 3 days since being marked as stale.

@github-actions github-actions bot closed this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize LatencyFaultToleranceImpl#updateFaultItem method

3 participants