Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restart ws connection to rpc when it was dropped and sync lost blocks #227

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

frolvanya
Copy link
Contributor

@frolvanya frolvanya commented Feb 4, 2025

We found an issue when connection can be dropped right when new event should be found, so we need to fetch everything from the last_processed_block
image
image


error!("{chain_kind:?} WebSocket stream closed unexpectedly, reconnecting...");
start_block = None;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done to make sure that first start uses start_block (if it was provided as an argument) and then we need to switch back to using last_processed_block. Let me know if this should be refactored using better code practices

Also, same logic can be found in solana startup files

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, it is done in this way:

let mut last_processed_block = start_block.unwrap_or(redis.get_last_processed_block());
loop {
    lake::start(last_processed_block, &mut last_processed_block)
}

But you implementation is ok for now


error!("{chain_kind:?} WebSocket stream closed unexpectedly, reconnecting...");
start_block = None;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, it is done in this way:

let mut last_processed_block = start_block.unwrap_or(redis.get_last_processed_block());
loop {
    lake::start(last_processed_block, &mut last_processed_block)
}

But you implementation is ok for now

@frolvanya frolvanya merged commit 2a6a06e into feat/improved-logs Feb 7, 2025
10 checks passed
frolvanya added a commit that referenced this pull request Feb 7, 2025
* feat: added message field for solana transfers

* feat: provided more context in logs (#225)

* feat: provided more context in logs

* chore: updated omni-types

* chore: retry if attached deposit is too low

* chore: remove event if signature verification failed

* chore: added release relayer (#226)

* chore: added release relayer

* chore: try to adjust repo url

* chore: change workdir

* chore: rename

* chore: bring back correct yml

* chore: update contracts tag trigger

* chore: moved dist to correct place

* fix: deleted musl target

* fix: restart ws connection to rpc when it was dropped and sync lost blocks (#227)
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.

2 participants