I have problems with my open connections with RethinkDB. If errors occur in my Sinatra back-end app methods, the connection with Rethink is not closed. Therefore the number of open connections slowly increases.
This results in too many open connections, resulting in the error:
Error: the RethinkDB database is not available
So questions is twofold: First to help me out right now; how can I close the open Rethink connections? Secondly, how can I avoid the build-up of open connections? Should I open a connection for every call to my back-end, or should I just open a connection with Rethink once when my app is initiated?
Rethink looks promising, but a little help would be greatly appreciated!
I don't think there's a way to do that in RethinkDB right now. I opened a GitHub issue: github.com/rethinkdb/rethinkdb/issues/4873 . One option in the meantime is to use tcpkill
(or something similar) to terminate the connection.