Skip to content

feat(price_pusher): exponential backoff for Hermes reconnect#3624

Open
dhruvja wants to merge 1 commit intopyth-network:mainfrom
dhruvja:fix/hermes-reconnect-exponential-backoff
Open

feat(price_pusher): exponential backoff for Hermes reconnect#3624
dhruvja wants to merge 1 commit intopyth-network:mainfrom
dhruvja:fix/hermes-reconnect-exponential-backoff

Conversation

@dhruvja
Copy link
Copy Markdown

@dhruvja dhruvja commented Apr 22, 2026

Summary

The Hermes onerror handler in PythPriceListener retried with a flat 5-second delay and fire-and-forget void this.startListening(), which has two problems:

  • Every pusher instance globally hammers a flapping Hermes endpoint every 5 seconds with no backoff.
  • If the reconnect itself (getPriceUpdatesStream) rejects, it becomes an unhandled rejection.

This extracts the reconnect into a reconnectWithBackoff method that doubles its delay (1s → 30s cap) on each failed attempt, routes errors through the pino logger, and catches reconnect-time failures so they feed the next iteration instead of going unhandled. The existing health
check (which throws after 30s of no updates) still bounds the worst case.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel vercel Bot temporarily deployed to Preview – proposals April 22, 2026 07:41 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
api-reference Skipped Skipped Apr 22, 2026 7:42am
proposals Skipped Skipped Apr 22, 2026 7:42am

Request Review

@vercel vercel Bot temporarily deployed to Preview – api-reference April 22, 2026 07:41 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@dhruvja is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant