Pārlūkot izejas kodu

fix: increase threshold value (#2077)

* add const

* empty
guibescos 1 gadu atpakaļ
vecāks
revīzija
ad04400b83

+ 1 - 1
apps/price_pusher/package.json

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

+ 13 - 1
apps/price_pusher/src/solana/solana.ts

@@ -15,6 +15,8 @@ import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
 import { sliceAccumulatorUpdateData } from "@pythnetwork/price-service-sdk";
 import { Logger } from "pino";
 
+const HEALTH_CHECK_TIMEOUT_SECONDS = 60;
+
 export class SolanaPriceListener extends ChainPriceListener {
   constructor(
     private pythSolanaReceiver: PythSolanaReceiver,
@@ -35,7 +37,17 @@ export class SolanaPriceListener extends ChainPriceListener {
     const blockTime = await this.pythSolanaReceiver.connection.getBlockTime(
       slot
     );
-    if (blockTime === null || blockTime < Date.now() / 1000 - 50) {
+    if (
+      blockTime === null ||
+      blockTime < Date.now() / 1000 - HEALTH_CHECK_TIMEOUT_SECONDS
+    ) {
+      if (blockTime !== null) {
+        this.logger.info(
+          `Solana connection is behind by ${
+            Date.now() / 1000 - blockTime
+          } seconds`
+        );
+      }
       throw new Error("Solana connection is unhealthy");
     }
   }