xclient v0.7.0-vendored-xhttp XClient.Pool View Source
XClient.Pool provides an HTTP 1.x request connection pool based on XClient and Poolboy.
Example:
>>>> children = [XClient.Pool.child_spec(MyPool)]
>>>> {:ok, _pid} = Supervisor.start_link(children, strategy: :one_for_one)
>>>> XClient.Pool.request(MyPool, :get, "http://example.com")
{:ok, %XClient.Response{...}}
Link to this section Summary
Functions
Returns a child spec suitable to pass to e.g., Supervisor.start_link/2
Makes an HTTP 1.x request using an existing connection pool
Link to this section Functions
Returns a child spec suitable to pass to e.g., Supervisor.start_link/2.
Options:
:sizesets the initial pool size. Default is 10.:max_overflowsets the maximum number of additional connections under high load. Default is 5.:strategysets the pool connection-grabbing strategy. Valid values are:fifoand:lifo(default).
The :size and :max_overflow options are passed to Poolboy.
Link to this function
request(pool, method, url, headers \\ [], payload \\ "", opts \\ [])
View Source
request( pid(), XClient.method(), String.t(), XClient.headers(), String.t(), Keyword.t() ) :: {:ok, XClient.response()} | {:error, XClient.error()}
Makes an HTTP 1.x request using an existing connection pool.
Options:
:timeout- Response timeout in milliseconds. Defaults toApplication.get_env(:xclient, :request_timeout, 5000).