概述
我们之前在第一次请求的时候会出现超时的问题,我们来参考github关于这个问题的解析。
地址:https://github.com/spring-cloud/spring-cloud-netflix/issues/768
解决此问题有3种方法
方法1:把时间设长
这里设置5秒
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 5000
方法2:把超时发生异常属性关闭
hystrix:
command:
default:
execution:
timeout:
enabled: false
方法3:禁用feign的hystrix
feign:
hystrix:
enabled: false
这三种任意一种都能解决问题,已经实践过,只需要修改application.yml中添加这些配置即可。
或者
1)延长hystix的连接超时时间,默认时间是1秒
//在application配置文件中添加如下配置:
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds:5000
2)禁用hystix的超时时间//在application配置文件中添加如下配置:
hystrix.command.default.execution.timeout.enabled: false
3)禁用hystix//在application配置文件添加如下配置信息:
feign.hystrix.enabled: false
--------------------------------------------------------------------------------
QQ群:143522604
欢迎和大家一起学习、交流、提升!
--------------------------------------------------------------------------------