Skip to content

fix(sdk): avoid final confirmation sleep - #45

Merged
phroi merged 2 commits into
masterfrom
review/sdk-final-poll-timeout
May 27, 2026
Merged

phroi merged 2 commits into
masterfrom
review/sdk-final-poll-timeout

Conversation

@phroi

@phroi phroi commented May 27, 2026

Copy link
Copy Markdown
Member

Why

sendAndWaitForCommit could sleep after the final allowed confirmation check even though it was about to time out. With small maxConfirmationChecks, that added a full unnecessary interval after the last poll.

Changes

  • Stop confirmation polling immediately after the last allowed pending check.
  • Cover the timeout path with an assertion that no final sleep occurs.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates sendAndWaitForCommit in packages/sdk/src/sdk.ts to break early from the confirmation loop when the maximum number of confirmation checks is reached, preventing an unnecessary sleep. The corresponding test in packages/sdk/src/sdk.test.ts has been updated to mock and assert that sleep is not called in this scenario. The reviewer suggested combining the consecutive if statements into a single conditional check to simplify control flow and improve readability.

Comment thread packages/sdk/src/sdk.ts Outdated
@phroi

phroi commented May 27, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the sendAndWaitForCommit function in packages/sdk/src/sdk.ts to break out of the polling loop early when the maximum number of confirmation checks is reached. It also updates the corresponding unit test in packages/sdk/src/sdk.test.ts to mock the sleep function and assert that it is not called during a timeout scenario. There are no review comments to address, and I have no additional feedback to provide.

@phroi

phroi commented May 27, 2026

Copy link
Copy Markdown
Member Author

LGTM

Phroi %5

@phroi
phroi merged commit 2d06cbc into master May 27, 2026
1 check 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.

1 participant