MCPcopy
hub / github.com/CodisLabs/codis / newProxyStats

Method newProxyStats

pkg/topom/topom_stats.go:115–135  ·  view source on GitHub ↗
(p *models.Proxy, timeout time.Duration)

Source from the content-addressed store, hash-verified

113}
114
115func (s *Topom) newProxyStats(p *models.Proxy, timeout time.Duration) *ProxyStats {
116 var ch = make(chan struct{})
117 stats := &ProxyStats{}
118
119 go func() {
120 defer close(ch)
121 x, err := s.newProxyClient(p).StatsSimple()
122 if err != nil {
123 stats.Error = rpc.NewRemoteError(err)
124 } else {
125 stats.Stats = x
126 }
127 }()
128
129 select {
130 case <-ch:
131 return stats
132 case <-time.After(timeout):
133 return &ProxyStats{Timeout: true}
134 }
135}
136
137func (s *Topom) RefreshProxyStats(timeout time.Duration) (*sync2.Future, error) {
138 s.mu.Lock()

Callers 1

RefreshProxyStatsMethod · 0.95

Calls 3

newProxyClientMethod · 0.95
StatsSimpleMethod · 0.80
AfterMethod · 0.65

Tested by

no test coverage detected