Restart pusher on balance issues (#1125)

* Restart pusher on balance issues

* Bump
This commit is contained in:
Amin Moghaddam 2023-10-31 08:39:22 +01:00 committed by GitHub
parent d07579e0a6
commit d4fad5049c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

2
package-lock.json generated
View File

@ -54807,7 +54807,7 @@
}, },
"price_pusher": { "price_pusher": {
"name": "@pythnetwork/price-pusher", "name": "@pythnetwork/price-pusher",
"version": "5.7.0", "version": "5.7.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@injectivelabs/sdk-ts": "1.10.72", "@injectivelabs/sdk-ts": "1.10.72",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pythnetwork/price-pusher", "name": "@pythnetwork/price-pusher",
"version": "5.7.0", "version": "5.7.1",
"description": "Pyth Price Pusher", "description": "Pyth Price Pusher",
"homepage": "https://pyth.network", "homepage": "https://pyth.network",
"main": "lib/index.js", "main": "lib/index.js",

View File

@ -299,10 +299,12 @@ export class SuiPricePusher implements IPricePusher {
); );
} catch (e: any) { } catch (e: any) {
console.log("Error when signAndExecuteTransactionBlock"); console.log("Error when signAndExecuteTransactionBlock");
if (String(e).includes("GasBalanceTooLow")) { if (
console.warn( String(e).includes("Balance of gas object") ||
`The balance of gas object ${gasObject.objectId} is too low. Removing from pool.` String(e).includes("GasBalanceTooLow")
); ) {
// If the error is caused by insufficient gas, we should panic
throw e;
} else { } else {
// Refresh the coin object here in case the error is caused by an object version mismatch. // Refresh the coin object here in case the error is caused by an object version mismatch.
nextGasObject = await SuiPricePusher.tryRefreshObjectReference( nextGasObject = await SuiPricePusher.tryRefreshObjectReference(