Created
September 29, 2016 10:08
-
-
Save l33z3r/6f783edc6258367d2ef9fa7c2402e666 to your computer and use it in GitHub Desktop.
Memory Leak With RabbitMQ (3.2.4) and Bunny Gem (2.5.1) On Ruby. Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bunny' | |
require 'pry' | |
puts 'Connecting...' | |
conn = Bunny.new | |
conn.start | |
channel = conn.create_channel | |
queue = channel.queue('hello') | |
puts 'Connected...' | |
fork do | |
loop do | |
queue.publish('Sample Message') | |
end | |
conn.close | |
end | |
queue.subscribe(:block => true) do |_delivery_info, _properties, body| | |
puts "Received #{body}" | |
# imitate some work | |
a = 0 | |
(1..100_000).each do |num| | |
a = a + 1 | |
end | |
end | |
conn.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment