Skip to content

Instantly share code, notes, and snippets.

@treeder
Created August 5, 2014 21:38
Show Gist options
  • Save treeder/59f1511d6fed03e50df2 to your computer and use it in GitHub Desktop.
Save treeder/59f1511d6fed03e50df2 to your computer and use it in GitHub Desktop.
source 'https://rubygems.org'
gem 'iron_mq', :git => 'https://github.com/iron-io/iron_mq_ruby.git', :branch => 'v3'
gem 'quicky'
gem 'go'
gem 'uber_config'
require 'quicky'
require 'iron_mq'
NUM_MESSAGES = 10
@client = IronMQ::Client.new(:host => "",
project_id: "",
token: ""
)
queue_name = "quick_#{rand(1000)}"
queue = @client.queue(queue_name)
quicky = Quicky::Timer.new
j = 0
quicky.loop(:post, NUM_MESSAGES) do |i|
puts "==== POSTING #{i || j} =================================="
j += 1
body = "hello #{j}"
res = queue.post(body)
end
j = 0
while (msg = queue.reserve) != nil do
puts "==== GOT #{j} ==================="
puts msg.id
j += 1
end
puts "using queue #{queue_name}"
puts "count: #{quicky.results(:post).count}"
puts "avg post: #{quicky.results(:post).duration}"
puts "queue size: #{queue.reload.size}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment