Skip to content

Commit

Permalink
fix: presubmit error
Browse files Browse the repository at this point in the history
  • Loading branch information
alkatrivedi committed Apr 15, 2024
1 parent fcabb63 commit b84750a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions samples/insert-query-with-get-trasanction.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
async function main(instanceId, databaseId, projectId) {
// [START spanner_insert_query_with_get_transaction]
// Imports the Google Cloud client library.
const {Spanner} = require('@google-cloud/spanner');
const {Spanner, protos} = require('@google-cloud/spanner');
const Priority = protos.google.spanner.v1.RequestOptions.Priority;

/**
* TODO(developer): Uncomment the following lines before running the sample.
Expand All @@ -40,7 +41,10 @@ async function main(instanceId, databaseId, projectId) {

const options = {
optimisticLock: true,
};
requestOptions: {
priority: Priority.PRIORITY_LOW,
},
}

Check failure on line 47 in samples/insert-query-with-get-trasanction.js

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

const promise = await database.getTransaction(options);
const transaction = promise[0];
Expand Down
10 changes: 6 additions & 4 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2014,10 +2014,12 @@ class Database extends common.GrpcServiceObject {
? (optionsOrCallback as GetTransactionOptions)
: {};
this.pool_.getSession((err, session, transaction) => {
transaction!.requestOptions = Object.assign(
transaction!.requestOptions || {},
options.requestOptions
);
if(options.requestOptions) {

Check failure on line 2017 in src/database.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
transaction!.requestOptions = Object.assign(
transaction!.requestOptions || {},
options.requestOptions
);
}
if (options.optimisticLock) {
transaction!.useOptimisticLock();
}
Expand Down

0 comments on commit b84750a

Please sign in to comment.