Skip to content

Commit 63573a1

Browse files
authored
chore: updated the maxcommitdelay sample to be compatible with other lang (#2307)
1 parent a29af56 commit 63573a1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

samples/max-commit-delay.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}
8379
process.on('unhandledRejection', err => {

0 commit comments

Comments
 (0)