From 8ee733f9a2913650fac50c19f59973b743076fd3 Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Tue, 12 May 2026 08:37:21 -0600 Subject: [PATCH] Updated HTTP provider to use slice settings for timeout configuration Ensures this provider uses the slice settings as defaults so none of this is hard coded. This also allows folks to tweak these settings via the environment variables (as mentioned in the previous commit). Issue: 309 Milestone: minor --- config/providers/http.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/providers/http.rb b/config/providers/http.rb index 453f5d87..2fccb913 100644 --- a/config/providers/http.rb +++ b/config/providers/http.rb @@ -9,8 +9,12 @@ Hanami.app.register_provider :http do start do slice.start :logger + connect, read, write = slice[:settings].to_h.values_at :http_timeout_connect, + :http_timeout_read, + :http_timeout_write + http = ConnectionPool::Wrapper.new size: ENV.fetch("HANAMI_MAX_THREADS", 5) do - HTTP.timeout(connect: 2, read: 10, write: 10) + HTTP.timeout(connect:, read:, write:) .use(:auto_inflate) .use(logging: {logger: slice[:logger]}) .headers("User-Agent" => "http.rb/#{HTTP::VERSION} (#{Hanami.app.app_name})")