Skip to content

Waiters#292

Merged
richardwang1124 merged 50 commits into
decaffrom
feature/waiters
May 21, 2025
Merged

Waiters#292
richardwang1124 merged 50 commits into
decaffrom
feature/waiters

Conversation

@richardwang1124
Copy link
Copy Markdown
Contributor

@richardwang1124 richardwang1124 commented Apr 24, 2025

Description of changes:
Support the #waitable trait with waiters. Customers can use code generated waiters through client.wait_until(:waiter_name, params, options).

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

Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy/lib/smithy/generators/client.rb Outdated
Comment thread gems/smithy/lib/smithy/views/client/module.rb Outdated
Comment thread gems/smithy/spec/interfaces/client/waiters_spec.rb Outdated
end
expect_any_instance_of(waiter).to receive(:delay).and_wrap_original do |m, *args|
delay = m.call(*args)
expect(delay).to equal(5)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test case is an example of the question I had in my doc regarding waiter retries. Because the remaining time (5) minus the delay (value between min delay of 3 and max delay of 4) is less than the min delay, the final delay value is set to be equal to the remaining time, which is 5. However, this exceeds the max delay. Is this expected behavior?

Copy link
Copy Markdown
Contributor

@mullermp mullermp left a comment

Choose a reason for hiding this comment

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

Good start!

Comment thread gems/smithy-client/lib/smithy-client/waiters/errors.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy/lib/smithy/views/client/waiters.rb Outdated
Comment thread gems/smithy/lib/smithy/views/client/waiters.rb Outdated
Comment thread gems/smithy/spec/fixtures/wait_service/model.smithy Outdated
Comment thread model/weather.smithy Outdated
Comment thread gems/smithy/spec/interfaces/client/waiters_spec.rb
Copy link
Copy Markdown
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

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

Nice! Great work so far - mini-review since you are working through changes and etc.

Comment thread gems/smithy-client/lib/smithy-client/waiters/errors.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/waiter.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Copy link
Copy Markdown
Contributor

@mullermp mullermp left a comment

Choose a reason for hiding this comment

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

Nice! Getting better. Sorry for the barrage of comments.

Comment thread gems/smithy-client/lib/smithy-client/waiters.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/errors.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Copy link
Copy Markdown
Contributor

@mullermp mullermp left a comment

Choose a reason for hiding this comment

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

Nice! Clean ups are looking good. This should be very close.

Comment thread gems/smithy-client/lib/smithy-client/base.rb Outdated
Comment thread gems/smithy-client/lib/smithy-client/waiters/poller.rb Outdated
# @api private
module Waiters
<% waiters.each do |waiter| -%>
<% if waiter.deprecated -%>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Up to you - you can always have a method deprecated? instead of attribute accessor deprecated - since you never actually need to retrieve any nested value of deprecated, it's simply a boolean. That's more conventional.

Comment thread gems/smithy/lib/smithy/views/client/client.rb Outdated
@@ -0,0 +1,38 @@
$version: "2"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit - name of folder waiters

Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
Comment thread gems/smithy-client/spec/smithy-client/waiters_spec.rb Outdated
@richardwang1124 richardwang1124 merged commit 367738e into decaf May 21, 2025
17 checks passed
@richardwang1124 richardwang1124 deleted the feature/waiters branch May 21, 2025 23:05
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.

3 participants