swift-server / swift-server/async-http-client
HTTPClient timeout overrides timeout set in `HTTPClient.execute(_:timeout:logger:)`
Open
Nobody has claimed this yet.
kind/bug
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 156
- PR merge metrics
- No merged PRs in 30d
Description
If I create a HTTPClient as follows
let httpClient = HTTPClient(
eventLoopGroup: MultiThreadedEventLoopGroup.singleton,
configuration: .init(timeout: Timeout(read: .seconds(90))
)
and then call
let response = httpClient(request, timeout: .minutes(10), logger: logger)
the timeout in the execute call is ignored if it is longer than HTTPClient timeout.
This is particularly frustrating as HTTPClient.shared sets the timeout to be 90 seconds
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the HTTPClient(request, timeout:logger:) call and how its per-call timeout is combined with the HTTPClient configuration timeout. Confirm the behavior with a request using a timeout longer than the configured 90 seconds; done means the execute-call timeout is honored rather than capped by the client configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100