Connection Pool grinding to a halt and Timeout/Cancelling ongoing requests

I have a little side project which really turns into a big learning experience for akka-http and akka streams. The idea is to go through (a rather big) list of shortened urls and expand them.

See https://gist.github.com/oschrenk/2b56d3e23ba4da66ed70025c4d9dc044

It works good for a while but then the app just hangs. From my understanding, this happens quite a lot when one does not drain the underlying response streams. But in my opinion I do. The only place where I can think that might happen is in my timeout function where I discard ongoing requests after 10 seconds. But as a side-exploration I fail to see how to do request level timeouts in akka http.

How can I make sure that the connection pool is freeing the connections?
(Or is there something else wrong with my code? I attached the jstack output if that is of any help)

1 Like