Akka HTTP client per-request timeouts


(Alan Burlison) #1

Simple question: How do you set akka.http.client.idle-timeout on a per-request basis? Thanks.


(Johan Andrén) #2

I’m afraid the current API doesn’t provide much to help with this (yet), there is an example how to do per request timeouts in this issue: https://github.com/akka/akka-http/issues/622


(Alan Burlison) #3

Why wouldn’t this work?

Http().singleRequest(request, settings = ConnectionPoolSettings(actorSystem).withIdleTimeout(Duration.Inf))

Thanks.


(Johan Andrén) #4

Ah, maybe I misread your question, an idle timeout is per definition per connection, and not per request. I think I misunderstood you as asking about per request timeout rather than idle.

I’m honestly not quite sure about the semantics when you provide a custom ConnectionPoolSettings to singleRequest


(Alan Burlison) #5

Some experimentation would suggest that passing ConnectionPoolSettings in the way I suggest has no effect, at least not for setting the idle timeout - not sure if that’s a bug or a feature. I suspect that if you want set the idle timeout on a per-connection basis, you’d need to use the connection-level API to do so?