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

Explorer optimizations (read DB before asking network when possible) #784

Conversation

bchamagne
Copy link
Contributor

Description

Fetch explorer's data from DB if it is available on current node. This avoid plenty of network requests.
ALSO: Refactored a bit the pagination to be consistent across all pages

Fixes #730

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Tested the explorer

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bchamagne bchamagne requested a review from Neylix December 16, 2022 13:38
@bchamagne bchamagne added P2P Involve P2P networking DB Involve database core team Assigned to the core team labels Dec 16, 2022
@bchamagne
Copy link
Contributor Author

As discussed with @Neylix , the same optimisation can be used on many functions from the Archethic module.
Plus, I should not run an election to determine if the node has the local data, because elections change over time (they are based on the currently available nodes).

@bchamagne bchamagne force-pushed the 730-explorer-beaconchain-optimization branch from 86ef867 to f792328 Compare January 2, 2023 14:22
lib/archethic.ex Show resolved Hide resolved
@bchamagne bchamagne force-pushed the 730-explorer-beaconchain-optimization branch from 36a8ab4 to b79454c Compare January 3, 2023 10:26
@Neylix Neylix merged commit 47ddf4d into archethic-foundation:develop Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Assigned to the core team DB Involve database P2P Involve P2P networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

For explorer, fetch data from DB if they are available
2 participants