MCPcopy Create free account
hub / github.com/dearcode/candy / getClient

Method getClient

notice/gate.go:22–39  ·  view source on GitHub ↗
(addr string)

Source from the content-addressed store, hash-verified

20}
21
22func (g *gate) getClient(addr string) (meta.GateClient, error) {
23 g.Lock()
24 defer g.Unlock()
25
26 c, ok := g.clients[addr]
27 if ok {
28 return c, nil
29 }
30
31 conn, err := grpc.Dial(addr, grpc.WithInsecure(), grpc.WithTimeout(networkTimeout))
32 if err != nil {
33 return nil, errors.Trace(err)
34 }
35
36 c = meta.NewGateClient(conn)
37 g.clients[addr] = c
38 return c, nil
39}
40
41func (g *gate) notice(addr string, ids []*meta.PushID, msg *meta.PushMessage) error {
42 c, err := g.getClient(addr)

Callers 1

noticeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected