Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions samples/max-commit-delay.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function main(
projectId = 'my-project-id',
) {
// [START spanner_set_max_commit_delay]
// Imports the Google Cloud client library.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing the comments ?

const {Spanner, protos} = require('@google-cloud/spanner');

/**
Expand All @@ -38,8 +37,7 @@ function main(
projectId: projectId,
});

async function spannerSetMaxCommitDelay() {
// Gets a reference to a Cloud Spanner instance and database.
async function setMaxCommitDelay() {
const instance = spanner.instance(instanceId);
const database = instance.database(databaseId);

Expand All @@ -62,11 +60,9 @@ function main(
);

await transaction.commit({
// The maximum amount of time to delay the transaction to improve
// throughput.
maxCommitDelay: protos.google.protobuf.Duration({
seconds: 0, // 0 seconds
nanos: 100000000, // 100,000,000 nanoseconds = 100 milliseconds
nanos: 100000000, // 100 milliseconds
}),
});
} catch (err) {
Expand All @@ -77,7 +73,7 @@ function main(
}
});
}
spannerSetMaxCommitDelay();
setMaxCommitDelay();
// [END spanner_set_max_commit_delay]
}
process.on('unhandledRejection', err => {
Expand Down
Loading