You do not need the next_tick method that em-mongo uses for you. Define callbacks that are executed if db actions are executed. Here is the skeleton:
class NonBlockingFetcher include MongoConfig def initialize configure @connection = EM::Mongo::Connection.new(@server, @port) @collection = init_collection(@connection) end def fetch(value) mongo_cursor = @collection.find({KEY => value.to_s}) response = mongo_cursor.defer_as_a response.callback do |documents|
mosen source share