This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark/ips' | |
| require 'redis' | |
| class MethodProfiler | |
| def self.patch(klass, methods, name) | |
| patches = methods.map do |method_name| | |
| <<~RUBY | |
| unless defined?(#{method_name}__mp_unpatched) | |
| alias_method :#{method_name}__mp_unpatched, :#{method_name} | |
| def #{method_name}(*args, &blk) | |
| unless prof = Thread.current[:_method_profiler] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Commerce.Orders.MockWebsocketServer do | |
| use Plug.Router | |
| plug(:match) | |
| plug(:dispatch) | |
| match _ do | |
| send_resp(conn, 200, "Hello from plug") | |
| end |