Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit dff3c61

Browse files
committed
fix nits
1 parent a089244 commit dff3c61

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/KeyAwareChannel.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -410,27 +410,22 @@ static final class KeyAwareClientCallListener<ResponseT>
410410

411411
@Override
412412
public void onMessage(ResponseT message) {
413+
ByteString transactionId = null;
413414
if (message instanceof PartialResultSet) {
414415
PartialResultSet response = (PartialResultSet) message;
415416
if (response.hasCacheUpdate() && call.channelFinder != null) {
416417
call.channelFinder.update(response.getCacheUpdate());
417418
}
418-
ByteString transactionId = transactionIdFromMetadata(response);
419-
if (transactionId != null) {
420-
call.maybeRecordAffinity(transactionId);
421-
}
419+
transactionId = transactionIdFromMetadata(response);
422420
} else if (message instanceof ResultSet) {
423421
ResultSet response = (ResultSet) message;
424-
ByteString transactionId = transactionIdFromMetadata(response);
425-
if (transactionId != null) {
426-
call.maybeRecordAffinity(transactionId);
427-
}
422+
transactionId = transactionIdFromMetadata(response);
428423
} else if (message instanceof Transaction) {
429424
Transaction response = (Transaction) message;
430-
ByteString transactionId = transactionIdFromTransaction(response);
431-
if (transactionId != null) {
432-
call.maybeRecordAffinity(transactionId);
433-
}
425+
transactionId = transactionIdFromTransaction(response);
426+
}
427+
if (transactionId != null) {
428+
call.maybeRecordAffinity(transactionId);
434429
}
435430
super.onMessage(message);
436431
}

0 commit comments

Comments
 (0)