Skip to content

Conversation

@lopezi
Copy link
Collaborator

@lopezi lopezi commented Jan 21, 2026

Adds a 3-second delay between successful token transfer and backend topup call to ensure the ledger transaction is queryable. Also adds one automatic retry with a 2-second wait if the initial backend call fails.

Adds a 3-second delay between successful token transfer and backend
topup call to ensure the ledger transaction is queryable. Also adds
one automatic retry with a 2-second wait if the initial backend call
fails.
@lopezi lopezi requested a review from patnorris January 21, 2026 16:05
try {
const result = await makeTopupCall();
return result;
} catch (firstError) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if the backend call doesn't return properly (OK but Err), we need to retry as well

backendPromise = $store.gameStateCanisterActor.topUpCyclesForMainerAgent(topUpInput);

try {
const result = await makeTopupCall();
Copy link
Contributor

Choose a reason for hiding this comment

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

before we didn't await the backend response ("backendPromise") to avoid keeping the user on the screen too long. As we now await it, the user has to wait on the topup modal. Is there a good way to reconcile this with the retry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but it still closes the modal before the transaction completes. is that what you are considering here?

Copy link
Contributor

Choose a reason for hiding this comment

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

cool, then this sounds good

The retry logic now triggers not only on exceptions but also when the
backend call returns successfully but with an Err result variant.
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.

2 participants