Open tobyhede opened 12 years ago
The plot thickens.
If I have a reference to collection.find in my code, everything suddenly works as expected.
So the following will do the insert:
EventMachine.synchrony do
db = EM::Mongo::Connection.new("localhost", 27017).db('hot_test')
collection = db.collection('test')
collection.insert(:name => 'two', :position => 1)
collection.find
EventMachine.stop
end
If I remove collection.find, the insert does nothing.
In all cases I see the SocketException in the mongo log
Toby, currently em-synchrony only patches the find methods in em-mongo: https://github.com/igrigorik/em-synchrony/blob/master/lib/em-synchrony/em-mongo.rb#L62
Sorry about the confusion with this.. Two things we can do: (a) extend the patch to more methods, or (b) for a "quick fix" you can use Synchrony.sync
interface to make the insert operations behave as you would expect.
Thanks for the info. Had me stumped, but eventually had discovered the missing methods and started my own implementation. May progress with this while keeping an eye on these other branches to see what I may be able to contribute.
@tobyhede - I just updated my branch on that pull request with more functions wrapped or rewritten. Would love to both see your work and get your thoughts on the work I've done so far. As of right now, I'm close to code complete, am moving onto testing/bug fixing unless someone finds something wrong or broken.
We're going to try and put this into production soon (Weeks), so would love to get another set of eyes and or opinions into the mix.
Sujal
Any updates on this?
Run into a weird one.
I cannot insert when using 'em-synchrony/em-mongo' , but I can read.
My insert code is pretty much lifted from the specs:
I can insert using the 'regular' em-mongo gem with EventMachine.
I am seeing a SocketException in the mongo log.
This Exception also occurs when reading, but the values the read works:
Using MongoDB v2.0.1 on OS X.