Skip to content
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

Feature: Retry failed transaction #213

Open
n13 opened this issue Jul 19, 2023 · 1 comment
Open

Feature: Retry failed transaction #213

n13 opened this issue Jul 19, 2023 · 1 comment
Assignees
Labels

Comments

@n13
Copy link
Collaborator

n13 commented Jul 19, 2023

If a transaction fails with "timeout exceeded", try it again

In EOSService

Will provide some JS code that does that

@n13 n13 added the beta label Jul 19, 2023
@n13
Copy link
Collaborator Author

n13 commented Jul 19, 2023

this is some JS code that does this...

sleep for 3 seconds is too much - generally I would expect it to take less than 1 second.

This one's just a backend code service, so doesn't matter how long it's waiting. For the wallet, it should either not wait, or wait only 0.5 seconds or so

        try {
          res = await api.transact({
            actions
          }, trxConfig)
        }
        catch (err) {
          const errStr = ''+err
          console.log('TRANSACTION ERROR:', errStr)
          if (errStr.toLowerCase().includes('deadline exceeded')) {
            await sleep(3000)
            console.log('retrying...')
            res = await api.transact({
              actions
            }, trxConfig)
          } else {
            console.log("Error on actions: "+JSON.stringify(actions))
            throw err
          }
        }

@gguijarro-c-chwy gguijarro-c-chwy self-assigned this Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants