rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wenf...@apache.org
Subject [rocketmq-client-go] branch master updated: [ISSUE #701] Fix timeout of SendAsync
Date Mon, 19 Jul 2021 07:50:48 GMT
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 <imfan007@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 {

Mime
View raw message