Skip to content

Implement health check for background listener and database; add List…#260

Merged
K1NGD4VID merged 1 commit into
TrusTrove:mainfrom
kali-el:indexer-branch
Jul 12, 2026
Merged

Implement health check for background listener and database; add List…#260
K1NGD4VID merged 1 commit into
TrusTrove:mainfrom
kali-el:indexer-branch

Conversation

@kali-el

@kali-el kali-el commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the indexer fail safely when the background event listener crashes so the API does not continue serving stale data.

What this PR does

Graceful shutdown on listener failure

  • Adds shared listener health state so the HTTP API and background listener can report a common health status.
  • Makes the event listener stop with a fatal error when polling fails unexpectedly (for example, due to RPC rate limiting or database connectivity issues).
  • Triggers graceful shutdown of the HTTP server and database pool when the listener exits with an error, avoiding a stuck-but-healthy service.

Health endpoint improvements

  • Updates the /health endpoint to run a DB connectivity check and verify the listener is still active.
  • Returns 503 Service Unavailable when the listener is dead or the database is unreachable, making unhealthy instances visible to load balancers and operators.

Files touched

Tests

  • Added regression tests covering the health endpoint for healthy and degraded states.
  • Verified with:
cd indexer
go test ./api ./listener

Verification

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@kali-el is attempting to deploy a commit to the K1NGD4VID Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 3, 2026

Copy link
Copy Markdown

@kali-el Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@K1NGD4VID K1NGD4VID merged commit 1e4fee7 into TrusTrove:main Jul 12, 2026
1 check failed
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.

indexer: initiate graceful shutdown on listener loop failure

2 participants