Skip to content

Commit

Permalink
fix: increase threshold value (#2077)
Browse files Browse the repository at this point in the history
* add const

* empty
  • Loading branch information
guibescos authored Nov 5, 2024
1 parent de25f58 commit ad04400
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/price_pusher/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 13 additions & 1 deletion apps/price_pusher/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
}
}
Expand Down

0 comments on commit ad04400

Please sign in to comment.