File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ and understand how to run and work with Dgraph.
2525 - [ Run a mutation] ( #run-a-mutation )
2626 - [ Run a query] ( #run-a-query )
2727 - [ Commit a transaction] ( #commit-a-transaction )
28+ - [ Cleanup Resources] ( #cleanup-resources )
2829 - [ Debug mode] ( #debug-mode )
2930- [ Development] ( #development )
3031 - [ Building the source] ( #building-the-source )
@@ -238,6 +239,31 @@ try {
238239}
239240```
240241
242+ ### Cleanup Resources
243+
244+ To cleanup resources, you have to call ` DgraphClientStub#close() ` individually for
245+ all the instances of ` DgraphClientStub ` .
246+
247+ ``` js
248+ const SERVER_ADDR = " localhost:9080" ;
249+ const SERVER_CREDENTIALS = grpc .credentials .createInsecure ();
250+
251+ // Create instances of DgraphClientStub.
252+ const stub1 = new dgraph.DgraphClientStub (SERVER_ADDR , SERVER_CREDENTIALS );
253+ const stub2 = new dgraph.DgraphClientStub (SERVER_ADDR , SERVER_CREDENTIALS );
254+
255+ // Create an instance of DgraphClient.
256+ const dgraphClient = new dgraph.DgraphClient (stub1, stub2);
257+
258+ // ...
259+ // Use dgraphClient
260+ // ...
261+
262+ // Cleanup resources.
263+ stub1 .close ();
264+ stub2 .close ();
265+ ```
266+
241267### Debug mode
242268
243269Debug mode can be used to print helpful debug messages while performing alters,
You can’t perform that action at this time.
0 commit comments