在我们的项目中,我们使用以下Hystrix配置。我对command.default.execution.timeout.enabled属性感到困惑。它设置为false,但与此同时,我们还有另一个属性,它指定timeoutInMilliseconds,据我的理解,该属性指定了呼叫者观察到超时的时间。因此,如果首先将执行超时设置为false,那么拥有第二个属性有什么意义呢?如果我的理解不正确,请告诉我
#
# Hystrix configuration
#
hystrix:
command.default.execution.timeout.enabled: false
command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
首先,请仔细阅读文档here。详细说明。在页面的开头,有“默认”的定义。请检查一下。
现在要回答您的特定问题默认情况下,command.default.execution.timeout.enabled
值设置为true。如您在section中所看到的。因此,使用这样的代码
command.default.execution.timeout.enabled: false
您将其覆盖为错误。这意味着hystrix不会暂停任何呼叫。但是您也可以在同一部分中看到,我们可以使用commandkey为特定实例启用或禁用。
command.default.execution.isolation.thread.timeoutInMilliseconds
同样适用
我们有一个默认值,我们也可以为特定的命令键更改此值。
假设当前您拥有这个
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作为mysinstancekey的超时值