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

fix: optimize spaces helpers #887

Merged
merged 9 commits into from
Jul 22, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jul 14, 2024

Use the new vote_count, proposal_count and follower_count columns from the spaces table to retrieve total number of items per space, instead of using a COUNT(id) as COUNT select.

Also some refactoring to add types, and cleaning.

The whole script now run in 40 seconds (instead of > 10 minutes), with 95% of the time spend on loading all spaces.

How to test

  1. Connect your snapshot UI to a hub with running branch
  2. Front page should load the same spaces, in the same order

@wa0x6e wa0x6e marked this pull request as ready for review July 14, 2024 04:27
@wa0x6e wa0x6e requested a review from ChaituVR July 17, 2024 08:36
…into fix-use-counter-columns-from-spaces-table
src/helpers/spaces.ts Outdated Show resolved Hide resolved
src/helpers/spaces.ts Outdated Show resolved Hide resolved
src/helpers/spaces.ts Outdated Show resolved Hide resolved
@ChaituVR
Copy link
Member

I think solution should be to ignore total counts here in these queries, but use space counts directly on mapSpaces in src/helpers/spaces.ts

@wa0x6e wa0x6e marked this pull request as draft July 18, 2024 04:47
@wa0x6e wa0x6e changed the title fix: use new counter columns from table spaces fix: optimize spaces helpers Jul 18, 2024
@wa0x6e wa0x6e marked this pull request as ready for review July 18, 2024 12:37
@wa0x6e wa0x6e requested a review from ChaituVR July 18, 2024 12:44
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck 👍

@wa0x6e wa0x6e merged commit 6269b94 into master Jul 22, 2024
2 checks passed
@wa0x6e wa0x6e deleted the fix-use-counter-columns-from-spaces-table branch July 22, 2024 13:35
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.

2 participants