You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/05/24 01:33:41 UTC
[GitHub] [rocketmq-client-go] smiletrl commented on issue #667: [Master branch]a minor context inject bug
smiletrl commented on issue #667:
URL: https://github.com/apache/rocketmq-client-go/issues/667#issuecomment-846673399
See patch
```
diff --git a/producer/producer.go b/producer/producer.go
index 910bb23..9747192 100644
--- a/producer/producer.go
+++ b/producer/producer.go
@@ -528,7 +528,7 @@ func (tp *transactionProducer) SendMessageInTransaction(ctx context.Context, msg
default:
}
- tp.endTransaction(*rsp, err, localTransactionState)
+ tp.endTransaction(ctx, *rsp, err, localTransactionState)
transactionSendResult := &primitive.TransactionSendResult{
SendResult: rsp,
@@ -538,7 +538,7 @@ func (tp *transactionProducer) SendMessageInTransaction(ctx context.Context, msg
return transactionSendResult, nil
}
-func (tp *transactionProducer) endTransaction(result primitive.SendResult, err error, state primitive.LocalTransactionState) error {
+func (tp *transactionProducer) endTransaction(ctx context.Context, result primitive.SendResult, err error, state primitive.LocalTransactionState) error {
var msgID *primitive.MessageID
if len(result.OffsetMsgID) > 0 {
msgID, _ = primitive.UnmarshalMsgID([]byte(result.OffsetMsgID))
@@ -559,7 +559,7 @@ func (tp *transactionProducer) endTransaction(result primitive.SendResult, err e
req := remote.NewRemotingCommand(internal.ReqENDTransaction, requestHeader, nil)
req.Remark = tp.errRemark(err)
- return tp.producer.client.InvokeOneWay(context.Background(), brokerAddr, req, tp.producer.options.SendMsgTimeout)
+ return tp.producer.client.InvokeOneWay(ctx, brokerAddr, req, tp.producer.options.SendMsgTimeout)
}
func (tp *transactionProducer) errRemark(err error) string {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org