Skip to content

Commit 3d11648

Browse files
committed
fix: use context with timeout
1 parent b5bb9da commit 3d11648

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

template.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ import (
270270
reqCtx, cancelFn := context.WithTimeout(reqCtx, time.Second * {{ $method.Timeout }})
271271
defer cancelFn()
272272
var replyMsg *nats.Msg
273-
if replyMsg, err = client.NatsConn.RequestWithContext(ctx, "{{ $subject }}", t.Bytes()); err != nil {
273+
if replyMsg, err = client.NatsConn.RequestWithContext(reqCtx, "{{ $subject }}", t.Bytes()); err != nil {
274274
reqSpan.LogFields(log.Error(err))
275275
ext.Error.Set(reqSpan, true)
276276
return {{ $nilResult }} err
@@ -291,8 +291,6 @@ import (
291291
return {{ $nilResult }} err
292292
}
293293
294-
295-
296294
{{ if $hasResult }}
297295
{{ $result := (index $method.Results 0) }}
298296

0 commit comments

Comments
 (0)