public boolean isLeavingGroup() {
        MemberState state = state();
        return state == MemberState.PREPARE_LEAVING || state == MemberState.LEAVING;
    }
@return True if the member is preparing to leave the group (waiting for callbacks), or
leaving (sending last heartbeat). This is used to skip proactively leaving the group when
the consumer poll timer expires.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareMembershipManager.java