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 <96537294+wanyu...@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_wanyu...@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

Reply via email to