天天看點

關于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

繼續閱讀