Sha256: fcf4c81f9608bcfeb1d09bb14c90d9d4db98b42ab1e112e60ed48a41f3ae0a03
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
require 'excon' require 'httparty' require 'net/http' require 'open-uri' require 'rest_client' require 'tach' require 'typhoeus' require 'sinatra/base' require 'streamly_ffi' require 'curb' require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'z-http') module Benchmark class Server < Sinatra::Base def self.run Rack::Handler::WEBrick.run( Benchmark::Server.new, :Port => 9292, :AccessLog => [], :Logger => WEBrick::Log.new(nil, WEBrick::Log::ERROR) ) end get '/data/:amount' do |amount| 'x' * amount.to_i end end end def with_server(&block) pid = Process.fork do Benchmark::Server.run end loop do sleep(1) begin #Excon.get('http://localhost:9292/api/foo') break rescue end end yield ensure Process.kill(9, pid) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
z-http-request-0.2.0 | benchmarks/server.rb |
z-http-request-0.1.0 | benchmarks/server.rb |