guardian / gibbons

Cleanup monkeys for the CAPI API keys table
0 stars 0 forks source link

Cleanup OkHttp resources when done #9

Closed regiskuckaertz closed 6 years ago

regiskuckaertz commented 6 years ago

Unless you thoroughly read the JavaDoc, OkHttp will only let you know that it's leaking resources by issuing warnings through its own logger.

It turns out not closing responses can exhaust the thread pool allocated to the client and ultimately shut down the whole application.

Here I'm just making sure the resource is cleaned up no matter the outcome of the computation.

tomrf1 commented 6 years ago

👍 Nice, I wonder how many more instances we have of this

regiskuckaertz commented 6 years ago

I've used http4s in formstack-submitter and I'm not going back ✈️