我们之前在第一次请求的时候会出现超时的问题,我们来参考github关于这个问题的解析。
地址:https://github.com/spring-cloud/spring-cloud-netflix/issues/768
默认的请求时间为1秒,超过这个时间便超时异常。那么顺着这个思路我们有如下解决方式:
1、把时间设长
这里设置5秒
[html] view plain copy
- hystrix:
- command:
- default:
- execution:
- isolation:
- thread:
- timeoutInMilliseconds: 5000
2、把超时发生异常属性关闭
[html] view plain copy
- hystrix:
- command:
- default:
- execution:
- timeout:
- enabled: false
3、禁用feign的hystrix
[html] view plain copy
- feign:
- hystrix:
- enabled: false
这三种任意一种都能解决问题,已经实践过,只需要修改application.yml中添加这些配置即可。
https://segmentfault.com/a/1190000009939815#articleHeader1