Skip to content

Commit

Permalink
remove promise race
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Sep 25, 2023
1 parent 1346bcf commit 4d7973f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,9 @@ let startBlock;
let endBlock;
let tokenDecs = {};

const threeSecTimeout = _ => {
return new Promise((resolve, reject) => {
setTimeout(() => {
return reject(new Error('timeout'));
}, 10000);
});
}

const retryableWithTimeout = async promise => {
try {
return await Promise.race([promise, threeSecTimeout()]);
return await promise;
} catch (e) {
console.log(e)
return await retryableWithTimeout(promise);
Expand Down

0 comments on commit 4d7973f

Please sign in to comment.