lib/em-synchrony/mongo.rb in em-synchrony-1.0.0 vs lib/em-synchrony/mongo.rb in em-synchrony-1.0.1
- old
+ new
@@ -3,11 +3,13 @@
rescue LoadError => error
raise "Missing EM-Synchrony dependency: gem install mongo"
end
# monkey-patch Mongo to use em-synchrony's socket and thread classs
-silence_warnings do
+old_verbose = $VERBOSE
+begin
+ $VERBOSE = nil
class Mongo::Connection
TCPSocket = ::EventMachine::Synchrony::TCPSocket
Mutex = ::EventMachine::Synchrony::Thread::Mutex
ConditionVariable = ::EventMachine::Synchrony::Thread::ConditionVariable
end
@@ -27,6 +29,8 @@
res
end
end
Mongo::TimeoutHandler = EventMachine::Synchrony::MongoTimeoutHandler
-end
\ No newline at end of file
+ensure
+ $VERBOSE = old_verbose
+end