I'm using em-mongo with and without Goliath. There is a weird thing that I'm not able to close a connection:
I've tried conn.close almost everywhere (in and out of callback, out of method, in EM proc etc.), it always keep connection alive which consumes resources on server box
here is a snippet of problem I've reproduced:
def load_items
org = Fiber.current
conn = EM::Mongo::Connection.new('localhost')
database = conn.db('mydb')
coll = database.collection('itemscoll')
curs = coll.find({"active" => true}).defer_as_a.callback do |docs|
docs.each do |doc|
$items << doc["data"].to_s unless $existing.include?(doc["data"].to_s)
end
conn.close
org.resume
end
return Fiber.yield
end
EM.run do
Fiber.new{
load_items
EM.stop
}.resume
end
Hi
I'm using em-mongo with and without Goliath. There is a weird thing that I'm not able to close a connection:
I've tried conn.close almost everywhere (in and out of callback, out of method, in EM proc etc.), it always keep connection alive which consumes resources on server box
here is a snippet of problem I've reproduced: