Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading