[Backend] Implement Automatic Event Replay on RPC Node Re-synchronization - #768
Open
TochukwuJustice wants to merge 2 commits into
Open
[Backend] Implement Automatic Event Replay on RPC Node Re-synchronization#768TochukwuJustice wants to merge 2 commits into
TochukwuJustice wants to merge 2 commits into
Conversation
…e-synchronization Queries the database for the last processed ledger sequence when the in-memory state is uninitialized, detects gaps on reconnection, and sequentially catch-up replays missed ledgers.
|
@TochukwuJustice 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #585
Summary of Changes
Added query loading for the atomic last_collected_sequence from the SQLite database using get_latest_sequence() upon uninitialized startups.
Implemented a gap detection check on the latest ledger sequence returned by the RPC provider.
Triggered a catch-up replay loop inside collect_latest_fees() that sequentially fetches and stores fee data for all skipped ledgers in the gap.
Integrated error resilience: if fetching any replayed ledger fails, the catch-up gracefully stops, saving the latest successfully processed block sequence.
#Reason for Changes
Previously, when the RPC provider reconnected after an outage, ledgers produced during the downtime were skipped. By querying the last known ledger from the database and fetching all skipped ledgers sequentially on reconnection, we guarantee complete data collection and prevent gaps in analytics.