-
Notifications
You must be signed in to change notification settings - Fork 198
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: get network
data from DB directly
#722
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #722 +/- ##
=========================================
- Coverage 2.41% 2.39% -0.03%
=========================================
Files 39 39
Lines 2032 2050 +18
Branches 37 37
=========================================
Hits 49 49
- Misses 1946 1964 +18
Partials 37 37
☔ View full report in Codecov by Sentry. |
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.
But then we will miss new networks , where no one is using them yet
Aren’t they already missing from current implementation ? |
True lol. i thought we were using |
Would be nice if we could add it now 😄 so then maybe we can remove networks.json dependency on snapshot UI |
src/graphql/operations/networks.ts
Outdated
const query = ` | ||
SELECT | ||
JSON_UNQUOTE(JSON_EXTRACT(settings, '$.network')) as network, | ||
COUNT(name) AS spacesCount | ||
FROM spaces | ||
GROUP BY network | ||
ORDER BY spacesCount DESC; | ||
`; | ||
|
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.
Takes around 0.5 sec on prod, should be fine?
Added |
Not all fields from networks.json are returned, tell me if we need to add more. |
Pretty fast sql query, averaging 350ms execution time. We could save the computation by caching the whole thing, and using |
Need fix to also include networks from inside strategies |
🧿 Current issues / What's wrong ?
The
network
query on the hub is using data from space's cache.This create refresh lag, and dependency on the
space
cache object.💊 Fixes / Solution
Use a SQL query to get networks count data from the database, and return more network properties, allowing queries like:
🚧 Changes
🛠️ Tests