Skip to content

Commit

Permalink
double-check number of requests before pausing the consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
bsideup committed May 7, 2018
1 parent 658bab9 commit e453515
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ public Subscription subscribe(String topic, String groupId, Optional<String> aut
recordFlux
.filter(it -> it.getPartition() == partitionNum)
.delayUntil(record -> {
if (requests.decrementAndGet() <= 0) {
if (requests.decrementAndGet() < 0) {
return kafkaReceiver.doOnConsumer(consumer -> {
consumer.pause(partitionList);
if (requests.get() < 0) {
consumer.pause(partitionList);
}
return true;
});
} else {
Expand Down

0 comments on commit e453515

Please sign in to comment.