Skip to content

feat: configurable broker ping timeout for FastStream health check#102

Merged
lesnik512 merged 1 commit into
mainfrom
fix/ref-7-faststream-timeout
Jun 1, 2026
Merged

feat: configurable broker ping timeout for FastStream health check#102
lesnik512 merged 1 commit into
mainfrom
fix/ref-7-faststream-timeout

Conversation

@lesnik512

@lesnik512 lesnik512 commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Added faststream_health_check_broker_timeout: float = 5.0 to FastStreamConfig.
  • FastStreamHealthChecksInstrument._define_health_status now reads from the config instead of the previously hardcoded timeout=5.
  • New regression test patches broker.ping and asserts the configured value reaches it.

Default preserves existing behavior — pure-additive config option. Users with slow brokers (large Redis clusters under load, message queues with cold connections) can now bump the timeout without forking the library.

Closes REF-7 from an internal audit.

Test plan

  • just test -- 'tests/test_faststream_bootstrap.py::test_faststream_health_check_uses_configured_broker_timeout' -v — pass.
  • just test — 129/129.
  • just lint — clean.
  • Reviewer: confirm the field lives on FastStreamConfig (not HealthChecksConfig) — this was the locked decision in the sequencing spec because the timeout is FastStream-shaped.

🤖 Generated with Claude Code

FastStreamHealthChecksInstrument._define_health_status called
broker.ping(timeout=5) with a hardcoded 5-second timeout. For users
with slow brokers (large Redis clusters under load, message queues
with cold connections), this is a footgun.

Add faststream_health_check_broker_timeout: float = 5.0 to
FastStreamConfig. Default preserves the existing behavior; users can
now override.

The field lives on FastStreamConfig (not the shared HealthChecksConfig)
because the timeout is FastStream-shaped — it's specifically about a
message broker ping, not a generic concern that FastAPI/Litestar
health checks would share.

Regression test patches broker.ping to assert the configured timeout
value reaches it.

Closes REF-7 from the audit.
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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

Files with missing lines Coverage Δ
...bootstrap/bootstrappers/faststream_bootstrapper.py 100.00% <100.00%> (ø)
tests/test_faststream_bootstrap.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lesnik512 lesnik512 self-assigned this Jun 1, 2026
@lesnik512 lesnik512 merged commit 5bb07a5 into main Jun 1, 2026
8 checks passed
@lesnik512 lesnik512 deleted the fix/ref-7-faststream-timeout branch June 1, 2026 17:14
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.

1 participant