Class: Wayfarer::HTTPAdapters::AdapterPool
- Inherits:
-
Object
- Object
- Wayfarer::HTTPAdapters::AdapterPool
- Extended by:
- Forwardable
- Defined in:
- lib/wayfarer/http_adapters/adapter_pool.rb
Overview
A connection pool that hands out HTTP adapters.
Instance Method Summary collapse
-
#free ⇒ Object
Shuts down all HTTP adapters.
-
#initialize(job) ⇒ AdapterPool
constructor
A new instance of AdapterPool.
Constructor Details
#initialize(job) ⇒ AdapterPool
Returns a new instance of AdapterPool.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wayfarer/http_adapters/adapter_pool.rb', line 13 def initialize(job) @job = job @config = job.config size = @config.connection_count timeout = @config.connection_timeout @pool = ConnectionPool.new( size: size, timeout: timeout, &method(:instantiate_adapter) ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *argv, &proc) ⇒ Object (private)
51 52 53 54 |
# File 'lib/wayfarer/http_adapters/adapter_pool.rb', line 51 def method_missing(method, *argv, &proc) super if method == :shutdown @pool.public_send(method, *argv, &proc) end |
Instance Method Details
#free ⇒ Object
Shuts down all HTTP adapters
28 29 30 |
# File 'lib/wayfarer/http_adapters/adapter_pool.rb', line 28 def free @pool.shutdown(&:free) end |