Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
adam-fowler opened this issue Apr 2, 2025 · 2 comments
Labels
kind/bug Feature doesn't work as expected.

Comments

@adam-fowler
Copy link
Member

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

@Lukasa
Copy link
Collaborator

Lukasa commented Apr 9, 2025

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 Lukasa added the kind/bug Feature doesn't work as expected. label Apr 9, 2025
@adam-fowler
Copy link
Member Author

If I get time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants