async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

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

Open adam-fowler opened this issue 8 months ago • 2 comments

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

adam-fowler avatar Apr 02 '25 16:04 adam-fowler

Yeah, that seems to be the wrong priority: we should prefer the more specific timeout, not the less specific one. Would you be open to providing a patch @adam-fowler?

Lukasa avatar Apr 09 '25 12:04 Lukasa

If I get time.

adam-fowler avatar Apr 09 '25 12:04 adam-fowler