Skip to content

Commit

Permalink
cleanup: return instead of fallthrough + improve comment (#844)
Browse files Browse the repository at this point in the history
Return the TransactionSelector that is built instead of falling through to the end of
the method. The behavior does not change by this, but it makes it easier to read and
understand the code.

Fixes #830
  • Loading branch information
olavloite authored Feb 2, 2021
1 parent 118d1b3 commit 2c745f3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ TransactionSelector getTransactionSelector() {
// Aborted error if the call that included the BeginTransaction option fails. The
// Aborted error will cause the entire transaction to be retried, and the retry will use
// a separate BeginTransaction RPC.
TransactionSelector.newBuilder()
// If tx.get() returns successfully, this.transactionId will also have been set to a
// valid value as the latter is always set when a transaction id is returned by a
// statement.
return TransactionSelector.newBuilder()
.setId(tx.get(waitForTransactionTimeoutMillis, TimeUnit.MILLISECONDS))
.build();
}
Expand Down

0 comments on commit 2c745f3

Please sign in to comment.