The easy pool stores already initialized easy handles for future use. This is useful because creating them is quite expensive.
@api private
Return the easy pool.
@example Return easy pool.
hydra.easy_pool
@return [ Array<Ethon::Easy> ] The easy pool.
# File lib/typhoeus/hydra/easy_pool.rb, line 17 def easy_pool @easy_pool ||= [] end
Return an easy from pool.
@example Return easy.
hydra.get_easy
@return [ Ethon::Easy ] The easy.
# File lib/typhoeus/hydra/easy_pool.rb, line 37 def get_easy easy_pool.pop || Ethon::Easy.new end
Releases easy into pool. The easy handle is resetted before it gets back in.
@example Release easy.
hydra.release_easy(easy)
# File lib/typhoeus/hydra/easy_pool.rb, line 26 def release_easy(easy) easy.reset easy_pool << easy end