Browse Source

feign远程调用,第一次会出现超时问题

qzyReal 1 year ago
parent
commit
2a928893ce

+ 1 - 0
app.pid

@@ -0,0 +1 @@
+13940

+ 1 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java

@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 public interface AdminInterface {
 
 	/** 启/停边民的app账号登陆限制 */
-	@RequestMapping("rpc/isLock")
+	@RequestMapping("AppUser/rpc/isLock")
 	int isLock(@RequestParam("id") String id,
 			   @RequestParam("type") Integer type,
 			   @RequestParam("status") Integer status);

+ 1 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/cfg/SpCfgInterfaceFallback.java

@@ -22,7 +22,7 @@ public class SpCfgInterfaceFallback implements FallbackFactory<SpCfgInterface>
 	 */
 	@Override
 	public SpCfgInterface create(Throwable cause) {
-		
+		cause.printStackTrace();
 		
 		log.error("--------------------系统配置服务异常,触发降级: {}", cause.getMessage());
 		

+ 6 - 4
sp-core/sp-api/src/main/java/com/pj/api/consts/FeignFactory.java

@@ -1,5 +1,6 @@
 package com.pj.api.consts;
 
+import com.pj.api.client.admin.AdminInterface;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -22,8 +23,9 @@ public class FeignFactory {
 		FeignFactory.spCfgInterface = spCfgInterface;
 	}
 	
-	
-	
-	
-	
+	public static AdminInterface adminInterface;
+	@Autowired
+	public  void setAdminInterface(AdminInterface adminInterface) {
+		FeignFactory.adminInterface = adminInterface;
+	}
 }

+ 14 - 0
sp-core/sp-base/src/main/resources/application.yml

@@ -1,3 +1,17 @@
 # 端口
 
 
+feign:
+  hystrix:
+    enabled: true
+hystrix:
+  command:
+    default:
+      execution:
+        isolation:
+          thread:
+            timeoutInMilliseconds: 150000
+ribbon:
+  eager-load:
+    enabled: true
+    clients: sp-home,sp-admin,level-one-server,level-two-server,transport-server