Skip to content

Sync with WebSocket#616

Open
tdroxler wants to merge 1 commit intomasterfrom
syncing-with-wsclient
Open

Sync with WebSocket#616
tdroxler wants to merge 1 commit intomasterfrom
syncing-with-wsclient

Conversation

@tdroxler
Copy link
Member

@tdroxler tdroxler commented May 1, 2025

Update of #478 using the new websocket of full node and the WsClient
This PR needs the latest version of that node PR

the strategy stay the same:

  • Sync with BlockFlowSyncService as usual
  • Once we are up-to-date: latest block is less than 30s old we move to
    websocket syncing
  • If some blocks are missed between the last sync and the opening of the websocket, it will eventually recover them
    as we always make sure the parents are downloaded before inserting new blocks.
  • If websocket messages are late: > 30s old, we close the websocket and
    move back to http syncing. This can happen in case of network issue,
    this is safer as we could suddenly receive lots of message through the
    websocket and the DB can't follow (happen once in my tests)
  • If the websocket close for anyreason we also move back to http
    syncing.

The main idea is to always rely and fall back on our BlockFlowSyncService which is well tested in production.

I tried various edge cases, like cutting my network etc.

Still require some testing and extracting some config values

@tdroxler tdroxler requested a review from h0ngcha0 May 1, 2025 14:33
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