Skip to content

Commit 4a350a6

Browse files
committed
go
1 parent 1ee3105 commit 4a350a6

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

apps/price_pusher/src/solana/solana.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,24 @@ export class SolanaPriceListener extends ChainPriceListener {
3535
// and ensuring it is not older than 30 seconds.
3636
private async checkHealth() {
3737
const slot = await this.pythSolanaReceiver.connection.getSlot("finalized");
38-
const blockTime = await this.pythSolanaReceiver.connection.getBlockTime(
39-
slot
40-
);
41-
if (
42-
blockTime === null ||
43-
blockTime < Date.now() / 1000 - HEALTH_CHECK_TIMEOUT_SECONDS
44-
) {
45-
if (blockTime !== null) {
46-
this.logger.info(
47-
`Solana connection is behind by ${
48-
Date.now() / 1000 - blockTime
49-
} seconds`
50-
);
38+
try {
39+
const blockTime = await this.pythSolanaReceiver.connection.getBlockTime(
40+
slot
41+
);
42+
if (
43+
blockTime === null ||
44+
blockTime < Date.now() / 1000 - HEALTH_CHECK_TIMEOUT_SECONDS
45+
) {
46+
if (blockTime !== null) {
47+
this.logger.info(
48+
`Solana connection is behind by ${
49+
Date.now() / 1000 - blockTime
50+
} seconds`
51+
);
52+
}
5153
}
54+
} catch (err) {
55+
this.logger.error({ err }, "checkHealth failed");
5256
}
5357
}
5458

0 commit comments

Comments
 (0)