@@ -23,7 +23,6 @@ function main(
2323 projectId = 'my-project-id' ,
2424) {
2525 // [START spanner_set_max_commit_delay]
26- // Imports the Google Cloud client library.
2726 const { Spanner, protos} = require ( '@google-cloud/spanner' ) ;
2827
2928 /**
@@ -38,8 +37,7 @@ function main(
3837 projectId : projectId ,
3938 } ) ;
4039
41- async function spannerSetMaxCommitDelay ( ) {
42- // Gets a reference to a Cloud Spanner instance and database.
40+ async function setMaxCommitDelay ( ) {
4341 const instance = spanner . instance ( instanceId ) ;
4442 const database = instance . database ( databaseId ) ;
4543
@@ -62,11 +60,9 @@ function main(
6260 ) ;
6361
6462 await transaction . commit ( {
65- // The maximum amount of time to delay the transaction to improve
66- // throughput.
6763 maxCommitDelay : protos . google . protobuf . Duration ( {
6864 seconds : 0 , // 0 seconds
69- nanos : 100000000 , // 100,000,000 nanoseconds = 100 milliseconds
65+ nanos : 100000000 , // 100 milliseconds
7066 } ) ,
7167 } ) ;
7268 } catch ( err ) {
@@ -77,7 +73,7 @@ function main(
7773 }
7874 } ) ;
7975 }
80- spannerSetMaxCommitDelay ( ) ;
76+ setMaxCommitDelay ( ) ;
8177 // [END spanner_set_max_commit_delay]
8278}
8379process . on ( 'unhandledRejection' , err => {
0 commit comments