Sha256: d5cec1a37027826bf36f971ba37601e52fff879c83862e0367435af1cd056ca4
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
$LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__)) require 'cgi' require 'digest/sha2' require 'typhoeus/easy' require 'typhoeus/multi' require 'typhoeus/native' require 'typhoeus/filter' require 'typhoeus/remote_method' require 'typhoeus/remote' require 'typhoeus/remote_proxy_object' require 'typhoeus/response' module Typhoeus VERSION = "0.0.24" def self.easy_object_pool @easy_objects ||= [] end def self.init_easy_object_pool 20.times do easy_object_pool << Typhoeus::Easy.new end end def self.release_easy_object(easy) easy.reset easy_object_pool << easy end def self.get_easy_object if easy_object_pool.empty? Typhoeus::Easy.new else easy_object_pool.pop end end def self.add_easy_request(easy_object) Thread.current[:curl_multi] ||= Typhoeus::Multi.new Thread.current[:curl_multi].add(easy_object) end def self.perform_easy_requests multi = Thread.current[:curl_multi] start_time = Time.now multi.easy_handles.each do |easy| easy.start_time = start_time end multi.perform end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pauldix-typhoeus-0.0.24 | lib/typhoeus.rb |