码迷,mamicode.com
首页 > 其他好文 > 详细

hystrix time out

时间:2020-09-17 12:21:19      阅读:26      评论:0      收藏:0      [点我收藏+]

标签:好处   overflow   cti   框架   use   nis   string   att   als   

 一般使用 hystrix.Do来跟踪请求,需要传入请求名,所以正则匹配一下想要自定义配置的请求名。然后这样:

这是go-hystrix下doc.go里面的内容,vender源码到项目的好处之一是可以轻松查看框架资料!

Synchronous API


Since calling a command and immediately waiting for it to finish is a common pattern, a synchronous API is available with the Do function which returns a single error.

err := hystrix.Do("my_command", func() error {
// talk to other services
return nil
}, nil)

Configure settings

During application boot, you can call ConfigureCommand to tweak the settings for each command.

hystrix.ConfigureCommand("my_command", hystrix.CommandConfig{
Timeout: 1000,
MaxConcurrentRequests: 100,
ErrorPercentThreshold: 25,
})

You can also use Configure which accepts a map[string]CommandConfig.


 
 

hystrix time out

标签:好处   overflow   cti   框架   use   nis   string   att   als   

原文地址:https://www.cnblogs.com/amtisy/p/13609114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!