rabbah commented on a change in pull request #3921: Synchronize access to the KafkaConsumer. URL: https://github.com/apache/incubator-openwhisk/pull/3921#discussion_r207581810
########## File path: common/scala/src/main/scala/whisk/connector/kafka/KafkaConsumerConnector.scala ########## @@ -182,10 +185,11 @@ class KafkaConsumerConnector( blocking { if (offset > 0) { val topicAndPartition = new TopicPartition(topic, 0) - consumer.endOffsets(Set(topicAndPartition).asJava).asScala.get(topicAndPartition).foreach { endOffset => - // endOffset could lag behind the offset reported by the consumer internally resulting in negative numbers - val queueSize = (endOffset - offset).max(0) - MetricEmitter.emitHistogramMetric(queueMetric, queueSize) + synchronized(consumer.endOffsets(Set(topicAndPartition).asJava)).asScala.get(topicAndPartition).foreach { Review comment: Referring to Line 159. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services