Cleaning up after performing an Operation

Moved from GitHub dgraph-js/44

Posted by aryzing:

The Readme discusses how to perform and clean up after transactions, but only discusses how to perform operations, such as updating the schema. In production, is it necessary to clean up after operations, such as closing or discarding the Operation object? An example in the Readme would be great!

paulftw commented :

Cleaning up a transaction is a necessary step because otherwise uncommitted writes can stay on the server indefinitely.
Cleaning up after operations is not needed because schema change is effectively a “commit now” operation. Normal javascript garbage collector will pick up the objects your app no longer holds links to.
I will see if this can be explained better in the docs, but in my experience nodejs modules are assumed to not need any destructors / cleanup unless there’s an explicit warning that they do.

paulftw commented :

Closing the issue as obsolete.

Checked the current version of docs – readme describes how to clean up when a clean up is necessary (i.e. in transactions and connection objects). Examples are present now.