perf(organization): load org page from DB and reconcile controller in background#919
Open
evertoncustodio wants to merge 2 commits into
Open
perf(organization): load org page from DB and reconcile controller in background#919evertoncustodio wants to merge 2 commits into
evertoncustodio wants to merge 2 commits into
Conversation
… background getOrgById previously made one ZeroTier controller request per member (sequentially), making the org page load extremely slow for large organizations (minutes for hundreds of networks). Count authorized/total members directly from the network_members rows already fetched from the database, and move the controller reconciliation (including 404 orphan cleanup) to a fire-and-forget background task so it no longer blocks the response. An in-flight guard prevents overlapping syncs per organization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The organization page (
getOrgById) made one ZeroTier controller requestper member, sequentially. For large orgs (hundreds of networks) this made
the page take minutes to load.
Changes
network_membersrowsalready fetched from the database (skipping deleted / permanently-deleted).
to a fire-and-forget background task so it no longer blocks the response.
overlapping controller syncs.
Tests
change them) and exclude deleted/permanently-deleted members.
Notes / trade-off
Counts reflect the DB's last-synced state. The
authorized/deletedflagsare kept fresh by the per-network page (
syncMemberPeersAndStatus); orphanedmembers are removed within one page load by the background reconcile.