You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/14 01:59:45 UTC

[GitHub] [incubator-shenyu] moremind opened a new pull request, #3554: [type:refactor] refactor redis blocking get method

moremind opened a new pull request, #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554

   <!-- Describe your PR here; eg. Fixes #3548-->
   Fixes #3548
   
   <!--
   Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [ ] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [ ] You submit test cases (unit or integration tests) that back your changes.
   - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] yu199195 commented on a diff in pull request #3554: [type:refactor] refactor redis blocking get method

Posted by GitBox <gi...@apache.org>.
yu199195 commented on code in PR #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554#discussion_r896426393


##########
shenyu-plugin/shenyu-plugin-cache/shenyu-plugin-cache-redis/src/main/java/org/apache/shenyu/plugin/cache/redis/RedisCache.java:
##########
@@ -58,7 +63,17 @@ public boolean cacheData(final String key, final byte[] bytes, final long timeou
      */
     @Override
     public boolean isExist(final String key) {
-        return Boolean.TRUE.equals(this.redisTemplate.hasKey(key).block());
+        CompletableFuture<Boolean> f = CompletableFuture.supplyAsync(() -> Mono.from(this.redisTemplate.hasKey(key)).block());
+        Boolean result = null;
+        try {
+            result = f.get(3, TimeUnit.SECONDS);
+        } catch (ExecutionException | TimeoutException | InterruptedException e) {
+            e.printStackTrace();

Review Comment:
   not used e.printStackTrace();



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] codecov-commenter commented on pull request #3554: [type:refactor] refactor redis blocking get method

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554#issuecomment-1154635028

   # [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3554](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (41edbc3) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/ad84b5416849663fb20c8a2b28de5b3c5036335d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ad84b54) will **decrease** coverage by `0.36%`.
   > The diff coverage is `62.50%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3554      +/-   ##
   ============================================
   - Coverage     62.83%   62.46%   -0.37%     
   + Complexity     5574     5536      -38     
   ============================================
     Files           842      842              
     Lines         23351    23357       +6     
     Branches       2118     2116       -2     
   ============================================
   - Hits          14672    14591      -81     
   - Misses         7331     7412      +81     
   - Partials       1348     1354       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...g/apache/shenyu/plugin/cache/redis/RedisCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWNhY2hlL3NoZW55dS1wbHVnaW4tY2FjaGUtcmVkaXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vY2FjaGUvcmVkaXMvUmVkaXNDYWNoZS5qYXZh) | `50.00% <62.50%> (+5.55%)` | :arrow_up: |
   | [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
   | [...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jYWNoZS9HcnBjQ2xpZW50Q2FjaGUuamF2YQ==) | `75.00% <0.00%> (-25.00%)` | :arrow_down: |
   | [...controller/ShenyuClientHttpRegistryController.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vY29udHJvbGxlci9TaGVueXVDbGllbnRIdHRwUmVnaXN0cnlDb250cm9sbGVyLmphdmE=) | `77.77% <0.00%> (-22.23%)` | :arrow_down: |
   | [...ogging/rocketmq/body/LoggingServerHttpRequest.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvYm9keS9Mb2dnaW5nU2VydmVySHR0cFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [...ruptor/RegisterClientServerDisruptorPublisher.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vZGlzcnVwdG9yL1JlZ2lzdGVyQ2xpZW50U2VydmVyRGlzcnVwdG9yUHVibGlzaGVyLmphdmE=) | `52.94% <0.00%> (-11.77%)` | :arrow_down: |
   | [...a/org/apache/shenyu/common/utils/VersionUtils.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi91dGlscy9WZXJzaW9uVXRpbHMuamF2YQ==) | `67.85% <0.00%> (-10.72%)` | :arrow_down: |
   | [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `54.25% <0.00%> (-9.58%)` | :arrow_down: |
   | [.../apache/shenyu/admin/model/dto/BatchCommonDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0JhdGNoQ29tbW9uRFRPLmphdmE=) | `50.00% <0.00%> (-7.15%)` | :arrow_down: |
   | [...apache/shenyu/admin/model/dto/AuthPathWarpDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoV2FycERUTy5qYXZh) | `57.14% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [38 more](https://codecov.io/gh/apache/incubator-shenyu/pull/3554/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ad84b54...41edbc3](https://codecov.io/gh/apache/incubator-shenyu/pull/3554?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] yu199195 merged pull request #3554: [type:refactor] refactor redis blocking get method

Posted by GitBox <gi...@apache.org>.
yu199195 merged PR #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] yu199195 commented on a diff in pull request #3554: [type:refactor] refactor redis blocking get method

Posted by GitBox <gi...@apache.org>.
yu199195 commented on code in PR #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554#discussion_r896426467


##########
shenyu-plugin/shenyu-plugin-cache/shenyu-plugin-cache-redis/src/main/java/org/apache/shenyu/plugin/cache/redis/RedisCache.java:
##########
@@ -68,7 +83,15 @@ public boolean isExist(final String key) {
      */
     @Override
     public byte[] getData(final String key) {
-        return this.redisTemplate.opsForValue().get(key).block();
+        CompletableFuture<byte[]> f = CompletableFuture.supplyAsync(() -> Mono.from(this.redisTemplate.opsForValue().get(key)).block());
+        byte[] result = null;
+        try {
+            // can't get result in 3 seconds, this handle will fail
+            result = f.get(3, TimeUnit.SECONDS);
+        } catch (ExecutionException | TimeoutException | InterruptedException e) {
+            e.printStackTrace();

Review Comment:
   e.printStackTrace();



##########
shenyu-plugin/shenyu-plugin-cache/shenyu-plugin-cache-redis/src/main/java/org/apache/shenyu/plugin/cache/redis/RedisCache.java:
##########
@@ -58,7 +63,17 @@ public boolean cacheData(final String key, final byte[] bytes, final long timeou
      */
     @Override
     public boolean isExist(final String key) {
-        return Boolean.TRUE.equals(this.redisTemplate.hasKey(key).block());
+        CompletableFuture<Boolean> f = CompletableFuture.supplyAsync(() -> Mono.from(this.redisTemplate.hasKey(key)).block());
+        Boolean result = null;
+        try {
+            result = f.get(3, TimeUnit.SECONDS);

Review Comment:
   this 3,can config?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org