Skip to content

Move done() to transaction.done(); #207

Description

@ryanseys

From the docs:

dataset.runInTransaction(function(transaction, done) {
  // From the `transaction` object, execute dataset methods as usual.
  // Call `done` when you're ready to commit all of the changes.
  transaction.get(dataset.key('Company', 123), function(err, entity) {
    if (err) {
      transaction.rollback(done);
      return;
    }

    done();
  });
}, function(err) {});

Any reason why done is separate from transaction?
Can we replace done with transaction.done?

Also, what does calling rollback with the done function do? Shouldn't it do this by default? It could if we can just call this.done() from within Transaction.prototype.rollback() ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions