-
-
Notifications
You must be signed in to change notification settings - Fork 300
feat: retry failed quote loads and surface quote errors in TransactionPayController #9837
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a36d9c4
feat: retry failed or empty quote loads in TransactionPayController
dan437 0519617
Merge remote-tracking branch 'origin/main' into feat/transaction-pay-…
dan437 61f1e76
feat: stamp quote retry attempts so failed retries wait a full interval
dan437 d1280af
feat: skip late quote writes when pay state was removed
dan437 a2c4b29
feat: drop stale no-op quotes on failed quote loads so retries can run
dan437 861555e
feat: treat failed quote loads as retry-pending so direct routes recover
dan437 fbefa81
feat: surface quote load failures only when quotes are needed and non…
dan437 efdbcab
docs: add changelog entries for quote load retry
dan437 351ba63
Merge branch 'main' into feat/transaction-pay-retry-failed-quote-loads
dan437 b94dcdd
style: format isQuoteRetryPending signature for oxfmt
dan437 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ import type { | |
| } from '../index.js'; | ||
| import { projectLogger } from '../logger.js'; | ||
| import type { UpdateTransactionDataCallback } from '../types.js'; | ||
| import { refreshQuotes } from '../utils/quotes.js'; | ||
| import { isQuoteRetryPending, refreshQuotes } from '../utils/quotes.js'; | ||
|
|
||
| const CHECK_INTERVAL = 1000; // 1 Second | ||
|
|
||
|
|
@@ -107,15 +107,20 @@ export class QuoteRefresher { | |
|
|
||
| #onStateChange(state: TransactionPayControllerState): void { | ||
| // No-op quotes never refresh, so they don't need the refresh loop. | ||
| const hasQuotes = Object.values(state.transactionData).some((transaction) => | ||
| transaction.quotes?.some( | ||
| (quote) => quote.strategy !== TransactionPayStrategy.None, | ||
| ), | ||
| // Transactions that need quotes but have none had a failed or empty | ||
| // quote load and need the loop to retry them. | ||
| const needsRefreshLoop = Object.values(state.transactionData).some( | ||
| (transaction) => | ||
| Boolean( | ||
| transaction.quotes?.some( | ||
| (quote) => quote.strategy !== TransactionPayStrategy.None, | ||
| ), | ||
| ) || isQuoteRetryPending(transaction), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, we need to confirm this is some Barbara wants. My original assumption was the error cases (provider or simulation errors) wouldn't fix themselves so redundant to have the extra traffic and UX skeletons etc. |
||
| ); | ||
|
|
||
| if (hasQuotes && !this.#isRunning) { | ||
| if (needsRefreshLoop && !this.#isRunning) { | ||
| this.#start(); | ||
| } else if (!hasQuotes && this.#isRunning) { | ||
| } else if (!needsRefreshLoop && this.#isRunning) { | ||
| this.#stop(); | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The
projectLoggeris thelogfunction itself for the main controller file.