Feign的超时问题

默认的请求时间为1秒,超过这个时间便超时异常。那么顺着这个思路我们有如下解决方式:

1、把时间设长

这里设置5秒

 

[html] view plain copy
  1. hystrix:  
  2.   command:  
  3.       default:  
  4.         execution:  
  5.           isolation:  
  6.             thread:  
  7.               timeoutInMilliseconds: 5000  

2、把超时发生异常属性关闭

 

[html] view plain copy
  1. hystrix:  
  2.   command:  
  3.       default:  
  4.         execution:  
  5.           timeout:  
  6.             enabled: false  

3、禁用feign的hystrix

 

[html] view plain copy
  1. feign:  
  2.   hystrix:  
  3.     enabled: false  


这三种任意一种都能解决问题,已经实践过,只需要修改application.yml中添加这些配置即可。

posted on 2018-01-10 11:31  wonder2636  阅读(3272)  评论(0编辑  收藏  举报

导航