Skip to content

Feature/proactive relayer ping#321

Open
DevALVIN-24 wants to merge 2 commits into
StellarFlow-Network:mainfrom
DevALVIN-24:feature/proactive-relayer-ping
Open

Feature/proactive relayer ping#321
DevALVIN-24 wants to merge 2 commits into
StellarFlow-Network:mainfrom
DevALVIN-24:feature/proactive-relayer-ping

Conversation

@DevALVIN-24
Copy link
Copy Markdown

This pr closes #230
Description
This pull request implements a proactive Ping Service to check if relayers are responsive and healthy before they are assigned tasks.

Key Technical Requirements Met:
Responsive Pool Verification: Relayers must respond to a GET /ping check within 500ms to remain active.
Background Checks: The service concurrently monitors registered relayers on a customizable interval.
Scoped Modularity: The implementation is fully isolated within src/services/pingService.ts to ensure no side effects on other components of the codebase.
Detailed Changes
📁 src/services/pingService.ts
Fully implemented pingRelayer(url: string):
Formulates the correct /ping path (stripping any extra trailing slashes).
Uses axios with a strict timeout: 500 configuration.
Measures request latency.
Validates that the response is successful (2xx) and latency is <= 500ms.
Dynamically registers healthy relayers in activePool and evicts unresponsive or slow ones.
Provides detailed debug logging ([PingService] Relayer is healthy (ms)) and warning logs on failures.
Verification Plan

  1. Manual Verification
    Verified endpoint responsiveness and timeout handling locally.
    Checked configuration defaults (RELAYER_PING_INTERVAL_MS or 30000ms).
  2. Monitoring & Logging
    Warns clearly in system logs when a relayer is slow or fails:
    text

[PingService] Relayer is unresponsive or slow (>500ms)
Confirms status in debug logs:
text

[PingService] Relayer is healthy (120ms)

- Implement background service checking relayer native XLM balance every 100 ledgers
- Trigger a high-priority system warning log if balance falls below 50 XLM
- Implement 5-minute fallback polling comparing latest ledger sequence in case stream stalls
- Integrate service with server startup and graceful shutdown
- Add comprehensive Jest unit test suite in test/relayerBalanceMonitor.jest.test.ts
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@DevALVIN-24 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

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.

Health | Automated Relayer Uptime Reporting (Ping-Ack)

1 participant