Skip to content

feat: default http client timeout to 30s#42

Merged
turegjorup merged 1 commit into
developfrom
feature/http-client-default-timeout
Jun 3, 2026
Merged

feat: default http client timeout to 30s#42
turegjorup merged 1 commit into
developfrom
feature/http-client-default-timeout

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Summary

The bundle exposes http_client_options (timeout, proxy, verify) but applied no defaults. An omitted timeout fell through to Guzzle's default of 0 — wait indefinitely — so a slow or hung identity provider could block a worker process forever. This PR adds a sensible default for the one option where it matters.

Features Added

  • http_client_options.timeout now defaults to 30 seconds when unset, bounding how long an IdP call can block a worker.
  • addDefaultsIfNotSet() on the http_client_options block so the default still materializes when the block is omitted entirely (the manager merges it via +=).
  • proxy (no sensible default) and verify (Guzzle already defaults to secure true) are deliberately left unset.

Files Changed

  • src/DependencyInjection/Configuration.php - Add addDefaultsIfNotSet() and defaultValue(30.0) on timeout.
  • tests/DependencyInjection/ConfigurationTest.php - Replace testHttpClientOptionsAbsentByDefault with testHttpClientOptionsDefaultsApplied, asserting the default applies while proxy/verify stay absent.
  • README.md - Document the new default and the timeout: 0 opt-out.
  • CHANGELOG.md - Add entry under [Unreleased].

Test Plan

  • task test — full suite passes (79 tests).
  • task analyze:php — PHPStan clean at max level.
  • Configure a provider with no http_client_options; confirm the Guzzle client receives timeout = 30.0.
  • Set timeout: 0 on a provider; confirm Guzzle reverts to wait-indefinitely behaviour.

🤖 Generated with Claude Code

Previously no timeout was applied to the underlying Guzzle client, so
Guzzle's own default (0 — wait indefinitely) was used and a slow or hung
identity provider could block worker processes forever.

The http_client_options block now applies a sensible default timeout of
30 seconds when none is set. Set timeout: 0 to restore the old behaviour,
or override per provider.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (af57823) to head (8294541).

Additional details and impacted files
@@             Coverage Diff             @@
##             develop       #42   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        62        62           
===========================================
  Files              9         9           
  Lines            280       282    +2     
===========================================
+ Hits             280       282    +2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@turegjorup turegjorup merged commit 7718045 into develop Jun 3, 2026
15 checks passed
@turegjorup turegjorup deleted the feature/http-client-default-timeout branch June 3, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants