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中添加这些配置即可。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM