You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/03 14:24:01 UTC
[GitHub] rabbah commented on a change in pull request #3921: Synchronize
access to the KafkaConsumer.
rabbah commented on a change in pull request #3921: Synchronize access to the KafkaConsumer.
URL: https://github.com/apache/incubator-openwhisk/pull/3921#discussion_r207560964
##########
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:
Here you’re synchronizing again given the outer sync. Is this because of the blocking block?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services