You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/10/06 23:40:02 UTC

[GitHub] [pulsar-client-go] mileschao commented on a change in pull request #65: [Issue 64] fix bug: type assert cause panic

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:
users@infra.apache.org


With regards,
Apache Git Services