You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by yu...@apache.org on 2024/10/17 01:47:36 UTC

(rocketmq-client-go) branch master updated: fix:callback function execution start context being canceled (#1175)

This is an automated email from the ASF dual-hosted git repository.

yuzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 3538144  fix:callback function execution start context being canceled (#1175)
3538144 is described below

commit 3538144ece7982b5e86c776e735df8d7e480c114
Author: EthanLeo <96...@users.noreply.github.com>
AuthorDate: Thu Oct 17 09:47:32 2024 +0800

    fix:callback function execution start context being canceled (#1175)
    
    Co-authored-by: 万玉勤 <o_...@shizhuang-inc.com>
---
 producer/producer.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/producer/producer.go b/producer/producer.go
index 00eb351..2cbeff6 100644
--- a/producer/producer.go
+++ b/producer/producer.go
@@ -403,7 +403,7 @@ func (p *defaultProducer) sendAsync(ctx context.Context, msg *primitive.Message,
 
 	ctx, cancel := context.WithTimeout(ctx, p.options.SendMsgTimeout)
 	err := p.client.InvokeAsync(ctx, addr, p.buildSendRequest(mq, msg), func(command *remote.RemotingCommand, err error) {
-		cancel()
+		defer cancel()
 		if err != nil {
 			h(ctx, nil, err)
 			return