You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "RobertIndie (via GitHub)" <gi...@apache.org> on 2023/04/24 08:26:16 UTC

[GitHub] [pulsar-client-go] RobertIndie commented on a diff in pull request #1003: [Flaky Test]: Fix flaky test TestMaxPendingChunkMessages()

RobertIndie commented on code in PR #1003:
URL: https://github.com/apache/pulsar-client-go/pull/1003#discussion_r1174946784


##########
pulsar/message_chunking_test.go:
##########
@@ -576,3 +548,27 @@ func createTestMessagePayload(size int) []byte {
 	}
 	return payload
 }
+
+//nolint:all
+func sendSingleChunk(p Producer, uuid string, chunkID int, totalChunks int) {
+	msg := &ProducerMessage{
+		Payload: []byte(fmt.Sprintf("chunk-%s-%d|", uuid, chunkID)),
+	}
+	producerImpl := p.(*producer).producers[0].(*partitionProducer)
+	mm := producerImpl.genMetadata(msg, len(msg.Payload), time.Now())
+	mm.Uuid = proto.String(uuid)
+	mm.NumChunksFromMsg = proto.Int32(int32(totalChunks))
+	mm.TotalChunkMsgSize = proto.Int32(int32(len(msg.Payload)))
+	mm.ChunkId = proto.Int32(int32(chunkID))
+	producerImpl.updateMetadataSeqID(mm, msg)
+
+	producerImpl.internalSingleSend(
+		mm,
+		msg.Payload,
+		&sendRequest{
+			callback: func(id MessageID, producerMessage *ProducerMessage, err error) {},
+			msg:      msg,
+		},
+		uint32(internal.MaxMessageSize),
+	)

Review Comment:
   We need to flush the producer after sending the message. Or handle the callback of the `sendRequest`.



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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org