<commit_before>module AMQPConnector

  def enqueue!(queue,data)

    encoded_data = data.class == String ? data : Yajl::Encoder.encode(data)

    q = Cloudsdale.bunny.queue(queue)
    e = Cloudsdale.bunny.exchange('')

    e.publish(encoded_data, :key => queue.to_s, :content_type => "application/json")

  end

end

Cloudsdale.bunny.queue 'faye'
Cloudsdale.bunny.queue 'drops'
<commit_msg>Try and reconnect to rabbitmq server when server-down received.<commit_after>module AMQPConnector

  def enqueue!(queue,data,tries=3)

    encoded_data = data.class == String ? data : Yajl::Encoder.encode(data)

    q = Cloudsdale.bunny.queue(queue)
    e = Cloudsdale.bunny.exchange('')

    e.publish(encoded_data, :key => queue.to_s, :content_type => "application/json")
  rescue Bunny::ServerDownError
    enqueue!(queue,data,(tries - 1)) if tries >= 1
  end

end

Cloudsdale.bunny.queue 'faye'
Cloudsdale.bunny.queue 'drops'

{'fraction_non_alphanumeric': 0.13260869565217392, 'fraction_numerical': 0.003260869565217391, 'mean_word_length': 4.41764705882353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4316295', 'n_tokens_mistral': 345, 'n_tokens_neox': 323, 'n_words': 63}