public boolean shouldHeartbeatNow() {
        MemberState state = state();
        return state == MemberState.ACKNOWLEDGING || state == MemberState.LEAVING || state == MemberState.JOINING;
    }
@return True if the member should send heartbeat to the coordinator without waiting for
the interval.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareMembershipManager.java