You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/25 10:58:03 UTC

[GitHub] markusthoemmes commented on issue #3976: close connections and reset pool on Container.pause

markusthoemmes commented on issue #3976: close connections and reset pool on Container.pause
URL: https://github.com/apache/incubator-openwhisk/pull/3976#issuecomment-415961185
 
 
   Yeah, streams and materialized values tend to get a little tricky. You can do this, to get the pool out of stream, along with the queue:
   
   ```scala
   private val (requestQueue, connectionPool) = Source
       .queue(queueSize, OverflowStrategy.dropNew)
       .viaMat(httpFlow.getOrElse(pool))(Keep.both)
       .to(Sink.foreach({
         case (response, p) => p.complete(response)
       }))
       .run
   ```
   
   (The type of the `httpFlow` value needs to change to have the `HostConnectionPool` as a materialized value as well. We should be able to put a `null`  there in the tests I think)
   
   The idle-timeout idea is great as well! If the above doesn't work reliably, we can try that. A third way is to pass the ActorMaterializer into the client (like it arguably should do anyway) and fix the `shutdown` method to actually just shutdown the connection pool.
   
   Note: This is all based on the assumption that destroying/recreating the whole thing is too costly. It might make sense to proof that if the optimization gets too ugly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services