pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar-client-go] WJL3333 commented on a change in pull request #252: [Issue 242][pulsar-client-go] feature: add send timeout
Date Wed, 20 May 2020 18:18:20 GMT

WJL3333 commented on a change in pull request #252:
URL: https://github.com/apache/pulsar-client-go/pull/252#discussion_r428214592



##########
File path: pulsar/producer_partition.go
##########
@@ -493,11 +637,100 @@ func (p *partitionProducer) Close() {
 	wg.Wait()
 }
 
+func (p *partitionProducer) beforeReceiveResponse(receipt *pb.CommandSendReceipt) {
+	if p.options.beforeReceiveResponseCallback != nil {
+		p.options.beforeReceiveResponseCallback(receipt)
+	}
+}
+
 type sendRequest struct {
 	ctx              context.Context
 	msg              *ProducerMessage
-	callback         func(MessageID, *ProducerMessage, error)
+	callback         *onceCallback
 	flushImmediately bool
+
+	sync.Mutex
+	callbackCalled bool
+
+	createAt               time.Time
+	gotSemaphoreAt         time.Time
+	addToBuilderAt         time.Time
+	flushAt                time.Time
+	lastTimeCheckCtxDoneAt time.Time
+	receiveResponseAt      time.Time
+	callBackCallAt         time.Time
+}
+
+type onceCallback struct {
+	once     sync.Once
+	callback func(MessageID, *ProducerMessage, error)
+}
+
+func (request *sendRequest) CallBack(messageID MessageID, msg *ProducerMessage, err error)
{
+	request.callback.once.Do(func() {
+		request.callback.callback(messageID, msg, err)
+		request.callBackCallAt = time.Now()
+		log.Debugf("gotSemaphoreCost=%v, addToBuilderCost=%v, "+

Review comment:
       remove the large debug log




----------------------------------------------------------------
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



Mime
View raw message