-
Notifications
You must be signed in to change notification settings - Fork 14
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
Web socket syncing #478
base: master
Are you sure you want to change the base?
Web socket syncing #478
Conversation
The strategy is: * Sync with `BlockFlowSyncService` as usual * Once we are up-to-date: latest block is less than 30s old we move to websocket syncing * 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. * 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.
Neat! We have WebSockets! Is the way to test this is to do a full sync and then manually terminate the server to test how it behaves? Tricky one to test. I'm letting it sync overnight and kinda manually causing abrupt server shutdowns to see how the connection & sync behaves, with debug statements, if I'm not careful enough it corrupts my RocksDB instance and I have to start over. Surely there is an easier way to test. Any suggestion?
Yep, tricky one indeed. |
If you shutdown the node, then the explorer-backend should also stop, but it sounds super weird that the node's rockDB get corrupted, the explorer-backend shouldn't have any influence on the node. how are you causing the abrupt shutdown? I could try to reproduce |
Oh it's not a bug. It's me intentionally causing abrupt/force shutdown to see how the connection behaves with |
Resolves: #353
After thousands of tests and adjustment I think we can start the discussion, it still needs some unit tests, but I'm not sure yet how easy it will be to test the websockets.
The PR needs https://github.com/alephium/dev-alephium/pull/827 from the node, because we need the
events
to match the data we receive from rest calls.The strategy is:
BlockFlowSyncService
as usualwebsocket syncing
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)
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.