swift-server / swift-server/async-http-client

HTTPClient timeout overrides timeout set in `HTTPClient.execute(_:timeout:logger:)`

Open
#825 2 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.