Skip to content

feat(util-waiter): add createWaiter()#1759

Merged
alexforsyth merged 5 commits intoaws:masterfrom
AllanZhengYP:refactor-util-waiter
Dec 14, 2020
Merged

feat(util-waiter): add createWaiter()#1759
alexforsyth merged 5 commits intoaws:masterfrom
AllanZhengYP:refactor-util-waiter

Conversation

@AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented Dec 10, 2020

Refactors: #1736

Refactor the original waiter util:

  1. expose a createWaiter() only to clients in order to reduce the duplicated code-gen
  2. fix infinite loop in job poller
  3. fix potential number overflow

Example of how clients may use these utils:

const waitForTableExists = (params: DynamoDBWaiter, input: DescribeTableInput): Promise<WaiterResult> => {
    return createWaiter({...waiterServiceDefaults, ...params}, params.client, input, tableExistsPoller);
}

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

Copy link
Contributor

@alexforsyth alexforsyth left a comment

Choose a reason for hiding this comment

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

@AllanZhengYP and I discussed this offline. LGTM! This is awesome

@codecov-io
Copy link

codecov-io commented Dec 10, 2020

Codecov Report

Merging #1759 (877fc88) into master (de75f7e) will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1759      +/-   ##
==========================================
+ Coverage   79.77%   79.85%   +0.07%     
==========================================
  Files         325      338      +13     
  Lines       12087    12644     +557     
  Branches     2553     2684     +131     
==========================================
+ Hits         9643    10097     +454     
- Misses       2444     2547     +103     
Impacted Files Coverage Δ
...tocol_tests/aws-restxml/commands/XmlMapsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlBlobsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlEnumsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ocol_tests/aws-restxml/commands/XmlListsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...col_tests/aws-restjson/commands/JsonMapsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonBlobsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonEnumsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...ol_tests/aws-restjson/commands/JsonListsCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...tests/aws-restxml/commands/XmlAttributesCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
...tests/aws-restxml/commands/XmlNamespacesCommand.ts 95.65% <0.00%> (-4.35%) ⬇️
... and 145 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62a6f5c...877fc88. Read the comment docs.

Refactor the original waiter util:
1. expose a createWaiter() only to clients in order to reduce the
duplicated code-gen
2. fix infinite loop in job poller
3. fix potential number overflow
The racing maxWaitTime will set a timeout that would eventually
hang the user's process. So remove it. Instead, we break the poller
promise if the totol wait time get close to the maxWaitTime config.
@alexforsyth alexforsyth merged commit 3d6eb2d into aws:master Dec 14, 2020
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants