add control message to data message
This commit is contained in:
@@ -29,8 +29,10 @@ func (p *TopicPublisher) FinishPublish() error {
|
||||
if inputBuffers, found := p.partition2Buffer.AllIntersections(0, pub_balancer.MaxPartitionCount); found {
|
||||
for _, inputBuffer := range inputBuffers {
|
||||
inputBuffer.Enqueue(&mq_pb.DataMessage{
|
||||
IsClose: true,
|
||||
TsNs: time.Now().UnixNano(),
|
||||
Ctrl: &mq_pb.ControlMessage{
|
||||
IsClose: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ func (p *TopicPublisher) doPublishToPartition(job *EachPartitionPublishJob) erro
|
||||
|
||||
publishCounter := 0
|
||||
for data, hasData := job.inputQueue.Dequeue(); hasData; data, hasData = job.inputQueue.Dequeue() {
|
||||
if data.IsClose {
|
||||
if data.Ctrl != nil && data.Ctrl.IsClose {
|
||||
// need to set this before sending to brokers, to avoid timing issue
|
||||
atomic.StoreInt32(&hasMoreData, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user