本文整理匯總了Golang中github.com/litl/shuttle/client.ServiceConfig.Rise方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceConfig.Rise方法的具體用法?Golang ServiceConfig.Rise怎麽用?Golang ServiceConfig.Rise使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/litl/shuttle/client.ServiceConfig
的用法示例。
在下文中一共展示了ServiceConfig.Rise方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setServiceDefaults
// set any missing global configuration on a new ServiceConfig.
// ServiceRegistry *must* be locked.
func (s *ServiceRegistry) setServiceDefaults(svc *client.ServiceConfig) {
if svc.Balance == "" && s.cfg.Balance != "" {
svc.Balance = s.cfg.Balance
}
if svc.CheckInterval == 0 && s.cfg.CheckInterval != 0 {
svc.CheckInterval = s.cfg.CheckInterval
}
if svc.Fall == 0 && s.cfg.Fall != 0 {
svc.Fall = s.cfg.Fall
}
if svc.Rise == 0 && s.cfg.Rise != 0 {
svc.Rise = s.cfg.Rise
}
if svc.ClientTimeout == 0 && s.cfg.ClientTimeout != 0 {
svc.ClientTimeout = s.cfg.ClientTimeout
}
if svc.ServerTimeout == 0 && s.cfg.ServerTimeout != 0 {
svc.ServerTimeout = s.cfg.ServerTimeout
}
if svc.DialTimeout == 0 && s.cfg.DialTimeout != 0 {
svc.DialTimeout = s.cfg.DialTimeout
}
if s.cfg.HTTPSRedirect {
svc.HTTPSRedirect = true
}
}
示例2: TestUpdateService
// check valid service updates
func (s *BasicSuite) TestUpdateService(c *C) {
svcCfg := client.ServiceConfig{
Name: "Update2",
Addr: "127.0.0.1:9324",
}
if err := Registry.AddService(svcCfg); err != nil {
c.Fatal(err)
}
svc := Registry.GetService("Update2")
if svc == nil {
c.Fatal(ErrNoService)
}
svcCfg.ServerTimeout = 1234
svcCfg.HTTPSRedirect = true
svcCfg.Fall = 5
svcCfg.Rise = 6
svcCfg.Balance = "LC"
// Now update the service for real
if err := Registry.UpdateService(svcCfg); err != nil {
c.Fatal(err)
}
svc = Registry.GetService("Update2")
if svc == nil {
c.Fatal(ErrNoService)
}
c.Assert(svc.ServerTimeout, Equals, 1234*time.Millisecond)
c.Assert(svc.HTTPSRedirect, Equals, true)
c.Assert(svc.Fall, Equals, 5)
c.Assert(svc.Rise, Equals, 6)
c.Assert(svc.Balance, Equals, "LC")
if err := Registry.RemoveService("Update2"); err != nil {
c.Fatal(err)
}
}