MCPcopy
hub / github.com/dgraph-io/dgraph / invokeNetworkRequest

Function invokeNetworkRequest

worker/task.go:43–55  ·  view source on GitHub ↗
(ctx context.Context, addr string,
	f func(context.Context, pb.WorkerClient) (interface{}, error))

Source from the content-addressed store, hash-verified

41)
42
43func invokeNetworkRequest(ctx context.Context, addr string,
44 f func(context.Context, pb.WorkerClient) (interface{}, error)) (interface{}, error) {
45 pl, err := conn.GetPools().Get(addr)
46 if err != nil {
47 return nil, errors.Wrapf(err, "dispatchTaskOverNetwork: while retrieving connection.")
48 }
49
50 span := trace.SpanFromContext(ctx)
51 span.AddEvent("invokeNetworkRequest", trace.WithAttributes(
52 attribute.String("destination", addr)))
53 c := pb.NewWorkerClient(pl.Get())
54 return f(ctx, c)
55}
56
57const backupRequestGracePeriod = time.Second
58

Callers 1

processWithBackupRequestFunction · 0.85

Calls 4

GetPoolsFunction · 0.92
NewWorkerClientFunction · 0.92
GetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected