ZihanLi58 commented on a change in pull request #3448:
URL: https://github.com/apache/gobblin/pull/3448#discussion_r778506245
##########
File path:
gobblin-modules/gobblin-service-kafka/src/main/java/org/apache/gobblin/service/StreamingKafkaSpecConsumer.java
##########
@@ -111,13 +113,15 @@ public StreamingKafkaSpecConsumer(Config config,
MutableJobCatalog jobCatalog) {
try {
Pair<SpecExecutor.Verb, Spec> specPair = _jobSpecQueue.take();
- _metrics.specConsumerJobSpecDeq.mark();
+ int numSpecFetched = 0;
do {
+ _metrics.specConsumerJobSpecDeq.mark();
+ numSpecFetched ++;
changesSpecs.add(specPair);
// if there are more elements then pass them along in this call
specPair = _jobSpecQueue.poll();
- } while (specPair != null);
+ } while (specPair != null && numSpecFetched < _jobSpecQueueSize);
Review comment:
Yes, it's just to make it to be finite as I notice that during some peek
time, we may end up with continually put elements into the queue and the loop
takes a long time to finish and yet cause the job to delay. I picked this value
because queue size is configurable and I think the max batch size(spec we
fetched at one time) and the max queue capacity should be positively related.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]