I have a web-service written in Akka where for each user I am making a post request(to encrypt some data) as follows:
http.singleRequest(HttpRequest(method = HttpMethods.POST, uri = encryptUrl, entity = request))
However after a few hits I am getting a ConnectionRefusedError
to the encryption server. It seems to be working intermittently. I looked up some potential issues but still nothing.
Finally I found one issue where not closing a connection could cause this scenario. Does it sound right ? Also how can I close a connection in the above case in Akka HTTP.