Skip to content

Commit

Permalink
Spanner: Close ResultSet from session keep-alive request (#6331)
Browse files Browse the repository at this point in the history
Fixes #6330

Closing the ResultSet also closes the span associated with the keep-alive
request, which fixes a tracing issue.
  • Loading branch information
sebright authored and olavloite committed Oct 2, 2019
1 parent 620af66 commit 758cfd6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,12 @@ public void prepareReadWriteTransaction() {

private void keepAlive() {
markUsed();
delegate
.singleUse(TimestampBound.ofMaxStaleness(60, TimeUnit.SECONDS))
.executeQuery(Statement.newBuilder("SELECT 1").build())
.next();
try (ResultSet resultSet =
delegate
.singleUse(TimestampBound.ofMaxStaleness(60, TimeUnit.SECONDS))
.executeQuery(Statement.newBuilder("SELECT 1").build())) {
resultSet.next();
}
}

private void markUsed() {
Expand Down

0 comments on commit 758cfd6

Please sign in to comment.