Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/hubspot/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ defmodule Hubspot.Application do
def start(_type, _args) do
children = [
{Cachex, name: :hubspot_cache},
{Finch, name: Hubspot.Common.API}
{Finch,
name: Hubspot.Common.API, pools: %{default: [conn_max_idle_time: :timer.seconds(340)]}}
]

# See https://hexdocs.pm/elixir/Supervisor.html
Expand Down
5 changes: 3 additions & 2 deletions lib/hubspot/common/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ defmodule Hubspot.Common.API do

@default_transport_retry_timeout 1_000
@retry_threshold 3
@receive_timeout 6_000
@pool_timeout 10_000

require Logger

def request(type, url, body \\ nil, headers \\ [], opts \\ []) do
opts = Keyword.merge([receive_timeout: 6_000], opts)
opts = Keyword.merge([receive_timeout: 6_000], opts)
opts = Keyword.merge([receive_timeout: @receive_timeout, pool_timeout: @pool_timeout], opts)

case :timer.tc(&do_send_request/5, [type, url, body, headers, opts]) do
{time, {:ok, response}} ->
Expand Down
Loading