-
Notifications
You must be signed in to change notification settings - Fork 615
Waiter waits before polling for first request #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The following benchmarking code waits for an average of ~ v2 Codeconst AWS = require("aws-sdk");
const { performance } = require("perf_hooks");
(async () => {
const region = "us-west-2";
const client = new AWS.S3({ region });
const waitTimes = [];
for (let i = 0; i < 20; i++) {
const Bucket = `test-waittime-${Math.ceil(Math.random() * 10 ** 10)}`;
await client.createBucket({ Bucket }).promise();
const start = performance.now();
await client.waitFor("bucketExists", { Bucket }).promise();
const end = performance.now();
waitTimes.push(end - start);
await client.deleteBucket({ Bucket }).promise();
}
const average = (arr) => arr.reduce((a, b) => a + b) / arr.length;
console.log({
min: Math.min(...waitTimes),
max: Math.max(...waitTimes),
average: average(waitTimes),
});
})(); v2 Output{
min: 64.88726702332497,
max: 328.0410579741001,
average: 90.74886234700679
} v3 Codeconst { S3, waitForBucketExists } = require("@aws-sdk/client-s3");
const { performance } = require("perf_hooks");
(async () => {
const region = "us-west-2";
const client = new S3({ region });
const waitTimes = [];
for (let i = 0; i < 20; i++) {
const Bucket = `test-waittime-${Math.ceil(Math.random() * 10 ** 10)}`;
await client.createBucket({ Bucket });
const start = performance.now();
await waitForBucketExists({ client }, { Bucket });
const end = performance.now();
waitTimes.push(end - start);
await client.deleteBucket({ Bucket });
}
const average = (arr) => arr.reduce((a, b) => a + b) / arr.length;
console.log({
min: Math.min(...waitTimes),
max: Math.max(...waitTimes),
average: average(waitTimes),
});
})(); v3 Output{
min: 5085.6809149980545,
max: 5108.293135017157,
average: 5093.321103353798
} |
This is a bug in v3 as per Step 1 of Smithy waitable trait:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Waiter waits before polling for first request, which it shouldn't.
SDK version number
"@aws-sdk/client-s3": "3.2.0",
"aws-sdk": "2.827.0",
Is the issue in the browser/Node.js/ReactNative?
All
Details of the browser/Node.js/ReactNative version
N/A
To Reproduce (observed behavior)
In v2, the waiter doesn't wait before making the first poll request.
v2 Code
v2 Output
Note that:
01.108
01.186
In v3, the waiter waits before making the first poll request.
v3 Code
v3 Output
Note that:
18.768
23.862
Expected behavior
The first poll request in v3 waiter should be done as soon as waiter is called.
The text was updated successfully, but these errors were encountered: