Skip to content

Commit ee4ef6e

Browse files
committed
Update README
1 parent ff4b1f1 commit ee4ef6e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff 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

243269
Debug mode can be used to print helpful debug messages while performing alters,

0 commit comments

Comments
 (0)