You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by we...@apache.org on 2021/07/19 07:50:48 UTC

[rocketmq-client-go] branch master updated: [ISSUE #701] Fix timeout of SendAsync

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

wenfeng 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 e5d5631  [ISSUE #701] Fix timeout of SendAsync
e5d5631 is described below

commit e5d56316563ab66b0c173ac6226867842eb2cbf4
Author: imfan <im...@163.com>
AuthorDate: Mon Jul 19 15:50:40 2021 +0800

    [ISSUE #701] Fix timeout of SendAsync
---
 producer/producer.go | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/producer/producer.go b/producer/producer.go
index f3b5afe..8ebb660 100644
--- a/producer/producer.go
+++ b/producer/producer.go
@@ -241,9 +241,7 @@ func (p *defaultProducer) sendAsync(ctx context.Context, msg *primitive.Message,
 		return errors.Errorf("topic=%s route info not found", mq.Topic)
 	}
 
-	var cancel context.CancelFunc
-	ctx, cancel = context.WithTimeout(ctx, 3*time.Second)
-	defer cancel()
+	ctx, _ = context.WithTimeout(ctx, 3*time.Second)
 	return p.client.InvokeAsync(ctx, addr, p.buildSendRequest(mq, msg), func(command *remote.RemotingCommand, err error) {
 		resp := primitive.NewSendResult()
 		if err != nil {