Skip to content

fix(util-waiter): fix waiter validation #1491

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

Merged
merged 4 commits into from
Jan 7, 2025
Merged

Conversation

smilkuri
Copy link
Contributor

@smilkuri smilkuri commented Jan 6, 2025

Issue #, if available:
aws/aws-sdk-js-v3#6767

Description of changes:
The waitUntilObjectExists function was incorrectly throwing an error:
Error: WaiterConfiguration.minDelay must be greater than 0
When minDelay was set to 0.5.

Changes Made:
Updated validateWaiterOptions to only throw an error if minDelay, maxDelay, or maxWaitTime are less than or equal to 0 instead of < 1.
Added a test case to verify that small values like 0.01 do not throw an error.
This ensures that fractional values (e.g., 0.5, 0.01) work correctly while keeping 0 invalid.

Testing
for util-waiter:

✓ src/waiter.spec.ts (5)
✓ src/utils/validate.spec.ts (7)
✓ src/poller.spec.ts (5)
✓ src/index.spec.ts (1)
✓ src/createWaiter.spec.ts (3)

Test Files 5 passed (5)
Tests 21 passed (21)
Start at 12:01:40
Duration 223ms (transform 105ms, setup 0ms, collect 212ms, tests 15ms, environment 0ms, prepare 227ms)

If one or more of the packages in the /packages directory has been modified, be sure yarn changeset add has been run and its output has
been committed and included in this pull request. See CONTRIBUTING.md.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@smilkuri smilkuri requested a review from a team as a code owner January 6, 2025 22:01
@smilkuri smilkuri changed the title fix(validate.ts): waitUntilObjectExists Validation for minDelay fix(util-waiter): fix waiter validation Jan 7, 2025
@kuhe
Copy link
Contributor

kuhe commented Jan 7, 2025

run yarn format at the repository root to format the files.

@kuhe kuhe merged commit a147146 into smithy-lang:main Jan 7, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants