<commit_before># encoding: utf-8

require 'spec_helper'
require 'integration/eventmachine/spec_helper'

require "multi_json"

describe AMQ::Client::EventMachineClient, "Basic.Publish" do
  include EventedSpec::SpecHelper
  default_timeout 21.0

  context "when message size exceeds negotiated frame size" do
    let(:message) { "z" * 1024 * 1024 * 8 }

    it "correctly frames things" do
      @received_messages = []

      @received_messages = []
      em_amqp_connect do |client|
        client.on_error do |conn, connection_close|
          fail "Handling a connection-level exception: #{connection_close.reply_text}"
        end

        channel = AMQ::Client::Channel.new(client, 1)
        channel.open do
          queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
          queue.bind("amq.fanout")

          queue.consume(true) do |amq_method|
            queue.on_delivery do |method, header, payload|
              @received_messages << payload
            end

            exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
            EventMachine.add_timer(2.0) do
              30.times do
                Thread.new do
                  exchange.publish(message, queue.name, {}, false, true)
                end
              end
            end
          end

          done(15.0) {
            # we don't care about the exact number, just the fact that there are
            # no UNEXPECTED_FRAME connection-level exceptions. MK.
            @received_messages.size.should > 10
            @received_messages.all? {|m| m == message}.should be_true
          }
        end
      end # em_amqp_connect
    end # it
  end # context
end # describe
<commit_msg>Try delayed here<commit_after># encoding: utf-8

require 'spec_helper'
require 'integration/eventmachine/spec_helper'

require "multi_json"

describe AMQ::Client::EventMachineClient, "Basic.Publish" do
  include EventedSpec::SpecHelper
  default_timeout 21.0

  context "when message size exceeds negotiated frame size" do
    let(:message) { "z" * 1024 * 1024 * 8 }

    it "correctly frames things" do
      @received_messages = []

      @received_messages = []
      em_amqp_connect do |client|
        client.on_error do |conn, connection_close|
          fail "Handling a connection-level exception: #{connection_close.reply_text}"
        end

        channel = AMQ::Client::Channel.new(client, 1)
        channel.open do
          queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
          queue.bind("amq.fanout")

          queue.consume(true) do |amq_method|
            queue.on_delivery do |method, header, payload|
              @received_messages << payload
            end

            exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
            EventMachine.add_timer(2.0) do
              30.times do
                Thread.new do
                  exchange.publish(message, queue.name, {}, false, true)
                end
              end
            end
          end

          delayed(15.0) {
            # we don't care about the exact number, just the fact that there are
            # no UNEXPECTED_FRAME connection-level exceptions. MK.
            @received_messages.size.should > 10
            @received_messages.all? {|m| m == message}.should be_true

            done
          }
        end
      end # em_amqp_connect
    end # it
  end # context
end # describe

{'fraction_non_alphanumeric': 0.09496567505720824, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 2.136322869955157, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '937206', 'n_tokens_mistral': 1045, 'n_tokens_neox': 968, 'n_words': 261}