Is tx.close() necessary in Javascript?

I have read the following two pieces of documentation and I have the question, is tx.close() necessary in Javascript?
https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-transactions https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-transactions.html
Gremlin transactions in Neptune - Amazon Neptune
How to use Gremlin transactions in Neptune.
Solution:
not necessary, commit/rollback will also close the transaction
Jump to solution
3 Replies
danielcraig23
danielcraig23OP8mo ago
try {
const gtx = tx.begin();

gtx.mergeV(
new Map([
[t.id, 'exampleId'],
[t.label, 'exampleLabel']
]))
.option(merge.onCreate, new Map([['lastUpdatedTime', eventTimeStamp]]))
.iterate();

tx.commit();
} catch (error) {
logger.error(error);
// roll back the transaction
tx.rollback();
}
try {
const gtx = tx.begin();

gtx.mergeV(
new Map([
[t.id, 'exampleId'],
[t.label, 'exampleLabel']
]))
.option(merge.onCreate, new Map([['lastUpdatedTime', eventTimeStamp]]))
.iterate();

tx.commit();
} catch (error) {
logger.error(error);
// roll back the transaction
tx.rollback();
}
Solution
Valentyn Kahamlyk
not necessary, commit/rollback will also close the transaction
danielcraig23
danielcraig23OP8mo ago
Thanks Valentyn
Want results from more Discord servers?
Add your server