Worker doesn't closes the connection
Closed this issue · 5 comments
Hi everyone,
I'm having a problem with sneaker leaking connection with RabbitMQ. I look up and didn't find anything that resolve my problem (or at least every thing that I tried, didn't work).
When my rails application worker consumes a message from the queue, it creates a connection on rabbitmq, but after finishing and sending the ack, the connection still open. That's happens with every message.
My worker is basically this:
class Worker
include Sneakers:Worker
from_queue 'test.queue',
retry_routing_key: 'test.queue'
arguments: { 'x-dead-letter-exchange': ENV['RETRY_EXCHANGE'] }
def work(message)
# do something
ack!
rescue => error
reject!
end
end
There is any settings to do close the connection after the worker finished?
As of a411f05,
sneakers/lib/sneakers/worker.rb
Lines 99 to 106 in a411f05
@Spaceghost thanks for the answer.
I don't understand the relation between the PR and the stop
method.
Where stop
is called?
For more information. I'm running the task sneakers:run
to create the workers.
Nevermind...
In some point of my code, i used the Sneakers::Publish publish method, and the connection still opened.
Thanks and closing...
I'm still looking for the PR you mentioned, would you mind dropping a link?
As for the use of #stop
, I'd either suggest looking through the code at least, if not using it or writing your own using what you learn from it. Sorry I can't be much help at the moment, my loadavg is ridiculous these days.