-
Notifications
You must be signed in to change notification settings - Fork 193
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
Don't error on duplicate pagination token #1748
Conversation
I currently have |
A new generated diff is ready to view.
A new doc preview is ready to view. |
It looks like Java V2 uses a customization to mark operations as ending pagination by returning a duplicate token. Go V2 requires the customer to specify a value for its |
/// Stop paginating when the service returns the same pagination token twice in a row. | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include docs on when this would be helpful to set to false:
When running status-checking operations or operations that you want to continually send in order to "watch" for the latest data (like AWS CloudWatch's
GetLogEvents
), set this to false. That way, you can continually call the paginator in order to receive new data as it becomes available.
I think this is the right approach to take. Infinite looping is something that people shouldn't be able to accidentally trigger unless the docs are very clear about when it happens. I do think we should add some info on why infinite looping is sometimes helpful and guide people to pass |
A new generated diff is ready to view.
A new doc preview is ready to view. |
0491fec
to
1d330fb
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Some AWS operations, such as CloudWatch's GetLogEvents, respond with duplicate next page tokens so that infinite polling can be done (for use cases such as tailing a log). The SDK was previously erroring out in the paginator for this use case (see awslabs/aws-sdk-rust#620).
This PR adds a
stop_on_duplicate_token
option to the paginators, and removes the error. This solution is the same as what the Go V2 SDK is doing.Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.