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.3.1",
"version": "8.3.2",
"description": "Pyth Price Pusher",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
47 changes: 32 additions & 15 deletions apps/price_pusher/src/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ export class SolanaPricePusher implements IPricePusher {
private computeUnitPriceMicroLamports: number
) {}

async updatePriceFeed(
priceIds: string[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_pubTimesToPush: number[]
): Promise<void> {
async updatePriceFeed(priceIds: string[]): Promise<void> {
if (priceIds.length === 0) {
return;
}
Expand Down Expand Up @@ -189,11 +185,11 @@ export class SolanaPricePusherJito implements IPricePusher {
}
}

async updatePriceFeed(
priceIds: string[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_pubTimesToPush: number[]
): Promise<void> {
private async sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}

async updatePriceFeed(priceIds: string[]): Promise<void> {
const recentJitoTip = await this.getRecentJitoTipLamports();
const jitoTip =
this.dynamicJitoTips && recentJitoTip !== undefined
Expand Down Expand Up @@ -234,11 +230,32 @@ export class SolanaPricePusherJito implements IPricePusher {
jitoBundleSize: this.jitoBundleSize,
});

await sendTransactionsJito(
transactions,
this.searcherClient,
this.pythSolanaReceiver.wallet
);
let retries = 60;
while (retries > 0) {
try {
await sendTransactionsJito(
transactions,
this.searcherClient,
this.pythSolanaReceiver.wallet
);
break;
} catch (err: any) {
if (err.code === 8 && err.details?.includes("Rate limit exceeded")) {
this.logger.warn("Rate limit hit, waiting before retry...");
await this.sleep(1100); // Wait slightly more than 1 second
retries--;
if (retries === 0) {
this.logger.error("Max retries reached for rate limit");
throw err;
}
} else {
throw err;
}
}
}

// Add a delay between bundles to avoid rate limiting
await this.sleep(1100);
}
}
}
Loading