I believe I am reading the code correctly (please close this if I'm not!) -- based on the docs for transactions I should do something like this:
ds.runInTransaction(function(txn, done) {
txn.get(key, function(err, entity) {
if (err) {
txn.rollback(done);
}
});
}, function(err) {});
However if the rollback fails, we'll call done without ever setting isFinalized = true. I believe this means we'll then try to commit the transaction, which doesn't seem like the desired outcome. It's ok to just not rollback the transaction, eventually it will expire, so rollback should always immediately set isFinalized = true.
Also I'm not sure if this gets fixed at all by the refactor that's currently happening with Transaction.
I believe I am reading the code correctly (please close this if I'm not!) -- based on the docs for transactions I should do something like this:
However if the rollback fails, we'll call
donewithout ever settingisFinalized = true. I believe this means we'll then try to commit the transaction, which doesn't seem like the desired outcome. It's ok to just not rollback the transaction, eventually it will expire, so rollback should always immediately setisFinalized = true.Also I'm not sure if this gets fixed at all by the refactor that's currently happening with Transaction.