Microservices 在Hystrix中使用execution.timeout.enabled和execution.isolation.thread.TimeoutInMillicles

Microservices 在Hystrix中使用execution.timeout.enabled和execution.isolation.thread.TimeoutInMillicles,microservices,hystrix,circuit-breaker,Microservices,Hystrix,Circuit Breaker,在我们的项目中,我们使用下面的Hystrix配置。我对command.default.execution.timeout.enabled属性感到困惑。它被设置为false,但同时我们还有另一个属性,它指定timeoutingmillizes,根据我的理解,它指定调用方观察超时的时间。那么,如果执行超时在第一个位置设置为false,那么拥有第二个属性有什么意义呢?如果我的理解不正确,请告诉我 # # Hystrix configuration # hystrix: command.defau

在我们的项目中,我们使用下面的Hystrix配置。我对command.default.execution.timeout.enabled属性感到困惑。它被设置为false,但同时我们还有另一个属性,它指定timeoutingmillizes,根据我的理解,它指定调用方观察超时的时间。那么,如果执行超时在第一个位置设置为false,那么拥有第二个属性有什么意义呢?如果我的理解不正确,请告诉我

#
# Hystrix configuration
#

hystrix:
  command.default.execution.timeout.enabled: false
  command.default.execution.isolation.thread.timeoutInMilliseconds: 60000

首先,请仔细阅读文档。对此进行了详细的解释。在页面的开头,有“默认”的定义。请检查一下

现在进入您的具体问题
默认情况下,
command.default.execution.timeout.enabled
值设置为true。正如你在这张照片上看到的。这样的代码

command.default.execution.timeout.enabled: false
您正在将其覆盖为false。这意味着hystrix不会超时任何呼叫。但您也可以在同一节中看到,我们可以使用commandkey启用或禁用特定实例

同样的情况也适用于
command.default.execution.isolation.thread.timeoutinems

我们有一个默认值,还可以为特定的commandkey更改此值

假设你现在有这个

hystrix:
  command.default.execution.timeout.enabled: false
  command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
几天后,您可以添加以下内容

command.myinstancekey.execution.timeout.enabled: true
在这种情况下,仅为myinstancekey启用超时,它将在60000后超时,因为它从

command.default.execution.isolation.thread.timeoutInMillisecond
如果你有

command.myinstancekey.execution.isolation.thread.timeoutInMillisecond: 30000 
然后将30000作为myInstanceKey的超时值