I have a number of scripts that all create there own connection, and I was trying to see if there was a cleanup function I need to run when I am finished with the connections and want to disconnect.
Is there a cleanup function?
Also is there a limit on connections?
I could not find answers to either of these questions, in the docs, or the code. It could be I am bad at looking.
I am planning to use DGraph via Lambda so every time a function is called it needs it’s own connection, so it’s important to understand any limits here.
It feel it would be worthwhile to have a cleanup/disconnect section after the “commit a transaction” section in these docs. I would consider adding this even if you don’t have to cleanup/disconnect as its something I often look for an answer for when working with DB clients.
There is no limit to connections. When a new client is created using new dgraph.DgraphClient(...DgraphClientStub), a new grpc channel is created for each DgraphClientStub. As long as the server can accept new connections, the client can create new channels.
The node.js grpc client v1.5 added a close method. I’ll add a method DgraphClientStub#close() to close the channel associated with DgraphClientStub. This will take care of cleaning up resources. There are a couple more methods that need to be exposed. They’ll be part of v1.0.1 to be released in a couple of days.