actorSystem isn't terminated after request
jorkzijlstra opened this issue · comments
ActorSystem("jiraExceptionProcessor") is created but never terminated.
What is your suggestion?
Implement the following:
def withWsClient[T](code: WSClient => T): T = {
val config = AhcWSClientConfig(wsClientConfig = defaultWsConfig)
val builder = new AhcConfigBuilder(config)
val ahcConfig = builder.configure().build()
implicit val system: ActorSystem = ActorSystem("resourceApiLoadTest")
implicit val materializer = ActorMaterializer()
val wsClient = new AhcWSClient(ahcConfig)
try code(wsClient)
finally {
wsClient.close()
system.terminate()
}
}
Ahh, I don't have time the next couple of weeks to add this, but feel free to do it yourself 😄
Really, no time for a couple of weeks to move 5 lines up in the scope and add 1.
Luckily I was already going to change this myself and just created the issue as an marker.
Haha, I see what you are saying and I totally agree that normally that would not be an issue. Thing is I wiped most of my drive and have no Scala tools on my machine and this is a change that I would certainly test. 😄
We will have to check what happens when 2 issues need to be created around the same time. I guess it might fail since the actorSystem will be shutdown after the first request.
A new actor system is created for each call to the function. I don't think the name is significant, but if it is you can make it unique.