天天看点

关于Hystrix一直进入服务降级问题

只要你在yml配置文件里面写上

feign:
  hystrix:
    enabled: true
           

然后开启你的微服务你就一直出现服务降级的问题,这主要是因为他的一个线程超时机制,默认好像是1s,对此有三个解决方法:

这个可以通过配置来解决此处提供三种方式,如下:

第一:设置超时时间变长,默认是1000毫秒

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 5000
           

第二:不设置超时时间

hystrix:
  command:
    default:
      execution:
        timeout:
          enabled: false
           

第三:直接禁用 其实这一条可以直接不写的。。。

feign.hystrix.enabled=false

继续阅读