-
Notifications
You must be signed in to change notification settings - Fork 16
graph_channels read from memory instead of from DB #879
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
base: develop
Are you sure you want to change the base?
graph_channels read from memory instead of from DB #879
Conversation
| .map(|node| JsonBytes::from_vec(node.cursor().to_bytes().into())) | ||
| .unwrap_or_default(); | ||
| let channels = network_graph.get_channels_with_params(limit, after); | ||
| let last_cursor = JsonBytes::from_vec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to use page and per_page as parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The param is still exposed as last_cursor for the external RPC, so even we change to network_graph.get_channels_with_params(per_page, page * per_page); the extern user feels no difference, and some unneccesary complexity is introduced: need to encode two (page, per_page) instead of one param (after) into last_cursor.
|
and to resolve #534, |
|
please do similar refactoring for |
The tricky part is we need to track private_channels_count or public_channels_count, since graph_channels interface only return public channels, updated in the commits |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #879 +/- ##
=======================================
Coverage 0.00% 0.00%
=======================================
Files 61 61
Lines 38148 38144 -4
=======================================
+ Misses 38148 38144 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
64f7d1d to
b44759c
Compare
Drawback:Since our paginate based on return count, the query result may contains duplicates or missing for multiple pages. It is acceptable since graph_channels is mainly used for statistics, one way to workaround this problems is to set limit large enough to return all channels in once.Also fixes #534
Updated the new commit use BTreeMap to store graph channels and nodes avoid the paginate drawback