You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/07/20 07:12:42 UTC

[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3205: fallback governance

liubao68 commented on code in PR #3205:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3205#discussion_r925253472


##########
governance/src/main/java/org/apache/servicecomb/injection/Fault.java:
##########
@@ -17,11 +17,18 @@
 
 package org.apache.servicecomb.injection;
 
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+
 import io.vavr.CheckedFunction0;
 
 public interface Fault {
   static <T> CheckedFunction0<T> decorateCheckedSupplier(Fault fault, CheckedFunction0<T> supplier) {
     return () -> {
+      if (fault.getPolicy().isForceClosed()){
+        return supplier.apply();
+      }else if (fault.getPolicy().getFallbackType().equals("ReturnNull")){

Review Comment:
   1. format code
   2. declare constant in FaultInjectionConst



-- 
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: commits-unsubscribe@servicecomb.apache.org

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