-
Notifications
You must be signed in to change notification settings - Fork 3
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
ORNode: stability of websocket connection and synchronization #3
Comments
Potential solution
The update to sync status should be in the same transaction as any other writes that happen while processing the event. RisksRPC API provider does not notify of some events;This would not protect against that. But any protections using the same API are unlikely to be reliable in this case. You will have to rely on other means to detect that there's an issue in this case. But this would a pretty serious fault on behalf of API provider so it is unlikely to happen and not be noticeable. There are gaps in the events processedThis sync function assumes that all events since sync status were missed. If that is not true for some reason (because of API provider failure or bug in the code), when this sync function might even mess up some records in DB or crash... The point is that whole ornode was coded with assumption that events happen once, and if that does not hold true, then there might be unexpected issues. The gaps in the events processed are currently likely because of dropped websocket connections. But this solution presented here makes gaps in the events processed very unlikely. Assuming this solution is coded correctly, the only thing I can think of that would cause this would be fault in API provider. In case gaps does happen, you would have to use custom solution (script?) to sync up or update the records in DB manually. |
Made an initial fix that is a lot more simple than what's suggested in above comment. It's implemented in ornode-sync branch and now merged in main.
This is not foolproof:
On the upside syncing is quite flexible in that you can fix gaps in processed events: You are able to not just sync from block N to now, but make it process events from any block range. Also exactly the same code is used to process events normally as when syncing, which avoids having to maintain two versions of event procesing. |
Infura drops idle websocket connections after a while. This is a problem for ornode, since for this use case there's sometimes no relevant events emitted for couple of days or even more. Already experienced this reliably with all ornode deployments.
A related issue here is what to do when ornode misses some events (because it crashes or connection was dropped). It should be informed of all events that happened while it weren't listening and it should process it.
The text was updated successfully, but these errors were encountered: