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