clolov commented on code in PR #21627:
URL: https://github.com/apache/kafka/pull/21627#discussion_r2890714312


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -8650,6 +8650,29 @@ private int consumerGroupHeartbeatIntervalMs(String 
groupId) {
             .orElse(config.consumerGroupHeartbeatIntervalMs());
     }
 
+    /**
+     * Get the interval between assignment updates of the provided consumer 
group.
+     */
+    // package private for testing
+    int consumerGroupAssignmentIntervalMs(String groupId) {
+        Optional<GroupConfig> groupConfig = 
groupConfigManager.groupConfig(groupId);
+        int assignmentIntervalMs = 
groupConfig.map(GroupConfig::consumerAssignmentIntervalMs)
+            .orElse(-1);
+        return assignmentIntervalMs >= 0 ?
+            assignmentIntervalMs :
+            config.consumerGroupAssignmentIntervalMs();
+    }

Review Comment:
   A possible alternative:
   ```
   public Optional<Integer> consumerAssignmentIntervalMs() {
       return consumerAssignmentIntervalMs >= 0
               ? Optional.of(consumerAssignmentIntervalMs)
               : Optional.empty();
   }
   ```
   and
   ```
   int consumerGroupAssignmentIntervalMs(String groupId) {
       return 
groupConfigManager.groupConfig(groupId).flatMap(GroupConfig::consumerAssignmentIntervalMs).orElse(config.consumerGroupAssignmentIntervalMs());
   }
   ```



-- 
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]

Reply via email to