mileschao commented on a change in pull request #65: [Issue 64] fix bug: type 
assert cause panic
URL: https://github.com/apache/pulsar-client-go/pull/65#discussion_r331817026
 
 

 ##########
 File path: pulsar/impl_partition_producer.go
 ##########
 @@ -293,14 +293,17 @@ func (p *partitionProducer) internalFlushCurrentBatch() {
 func (p *partitionProducer) internalFlush(fr *flushRequest) {
        p.internalFlushCurrentBatch()
 
-       pi := p.pendingQueue.PeekLast().(*pendingItem)
 
 Review comment:
   > In point of my view, if type is specific, meaning the item from 
pendingQueue is *pendingItem, we can not type assert with ok.
   
   As [comment on 
PeekLast](https://github.com/apache/pulsar-client-go/blob/7a9aa2b36371437b1c409cb21cb2056ded7f198d/util/blocking_queue.go#L40)
   
   > // PeekLast return last item in queue without dequeing, return nil if 
queue is empty
   
   PeekLast() returns nil if queue is empty.
   
   panic happens when ```PeekLast``` returns nil

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to