Skip to content

Instantly share code, notes, and snippets.

@Atalanta
Created April 10, 2015 02:47
Show Gist options
  • Save Atalanta/0f505376539891a5124e to your computer and use it in GitHub Desktop.
Save Atalanta/0f505376539891a5124e to your computer and use it in GitHub Desktop.
begin
users_queue.subscribe(:manual_ack => true, :block => true) do |delivery_info, properties, body|
sf, wm, em = *JSON.parse(body)
p [sf, wm , em]
urls = get_urls(sf, wm, em)
urls.each do |url|
url_queue.publish(url.to_json)
end
puts " [x] Queued #{urls.size} urls for #{em}"
users_channel.ack(delivery_info.delivery_tag)
count += 1
raise Interrupt, "Restart me" if count > 200
end
rescue Interrupt => _
conn.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment