Skip to content

Commit 28b118c

Browse files
committed
#736 use shared.Context insead of creating a new context
1 parent ef84c82 commit 28b118c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

โ€Žclient/client.goโ€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,12 @@ func (client *Client) Call(ctx context.Context, servicePath, serviceMethod strin
285285

286286
func (client *Client) call(ctx context.Context, servicePath, serviceMethod string, args interface{}, reply interface{}) error {
287287
seq := new(uint64)
288-
ctx = context.WithValue(ctx, seqKey{}, seq)
288+
289+
if sharedCtx, ok := ctx.(*share.Context); ok {
290+
sharedCtx.SetValue(seqKey{}, seq)
291+
} else {
292+
ctx = context.WithValue(ctx, seqKey{}, seq)
293+
}
289294

290295
if share.Trace {
291296
log.Debugf("client.call for %s.%s, args: %+v in case of client call", servicePath, serviceMethod, args)

0 commit comments

Comments
ย (0)