Sha256: a2c38fc89c391c9d3e19e362d1f5052ba97614fec5d9356520291fc241046a9b

Contents?: true

Size: 543 Bytes

Versions: 7

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

# Mongo/Mongoid 5 patches
class Mongo::Server::Connection
  def dispatch_with_timing(*args, &blk)
    return dispatch_without_timing(*args, &blk) unless SqlPatches.should_measure?

    result, _record = SqlPatches.record_sql(args[0][0].payload.inspect) do
      dispatch_without_timing(*args, &blk)
    end
    return result
  end

  # TODO: change to Module#prepend as soon as Ruby 1.9.3 support is dropped
  alias_method :dispatch_without_timing, :dispatch
  alias_method :dispatch, :dispatch_with_timing

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rack-mini-profiler-1.1.3 lib/patches/db/mongo.rb
rack-mini-profiler-1.1.2 lib/patches/db/mongo.rb
rack-mini-profiler-1.1.1 lib/patches/db/mongo.rb
rack-mini-profiler-1.1.0 lib/patches/db/mongo.rb
rack-mini-profiler-1.0.2 lib/patches/db/mongo.rb
rack-mini-profiler-1.0.1 lib/patches/db/mongo.rb
rack-mini-profiler-1.0.0 lib/patches/db/mongo.rb