[PR #3192] [MERGED] [management] Improve group peer/resource counting #19616

Closed
opened 2026-08-05 05:06:15 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/3192
Author: @pascal-fischer
Created: 1/16/2025
Status: Merged
Merged: 1/16/2025
Merged by: @pascal-fischer

Base: peers-get-account-refactoringHead: fix/improve-peers-group-counting


📝 Commits (7)

  • 1740abc extract group peer/resource counting
  • 80518ca adjust peer benchmark expectations
  • f1737df adjust peer benchmark expectations
  • 98b46eb adjust peer benchmark expectations
  • 8490776 Skip user check for system initiated peer deletion
  • fca330b Remove context in db calls
  • d7567fc adjust peer benchmark expectations

📊 Changes

7 files changed (+59 additions, -57 deletions)

View changed files

📝 .github/workflows/golang-test-linux.yml (+2 -2)
📝 management/server/groups/manager.go (+17 -22)
📝 management/server/http/handlers/networks/resources_handler.go (+15 -10)
📝 management/server/http/handlers/peers/peers_handler.go (+6 -6)
📝 management/server/http/testing/benchmarks/peers_handler_benchmark_test.go (+6 -6)
📝 management/server/peer.go (+8 -6)
📝 management/server/store/sql_store.go (+5 -5)

📄 Description

Describe your changes

This is purely a performance improvement by counting the peers and resources in each group once per resource and reusing that map.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/3192 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 1/16/2025 **Status:** ✅ Merged **Merged:** 1/16/2025 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `peers-get-account-refactoring` ← **Head:** `fix/improve-peers-group-counting` --- ### 📝 Commits (7) - [`1740abc`](https://github.com/netbirdio/netbird/commit/1740abcc524b69fbefafe6dc72ee5d90939bad86) extract group peer/resource counting - [`80518ca`](https://github.com/netbirdio/netbird/commit/80518cae0f7a066b32e48b20b151e509f828da48) adjust peer benchmark expectations - [`f1737df`](https://github.com/netbirdio/netbird/commit/f1737df373fcd57e86761102dfeb894f10d63c81) adjust peer benchmark expectations - [`98b46eb`](https://github.com/netbirdio/netbird/commit/98b46eb83ae898134a7d7b03cb25eb37daf46e7a) adjust peer benchmark expectations - [`8490776`](https://github.com/netbirdio/netbird/commit/8490776c21a968b9ed12c7a540a24acbe35282b0) Skip user check for system initiated peer deletion - [`fca330b`](https://github.com/netbirdio/netbird/commit/fca330b783d49e1c61a8b7478e0b5acc8d884567) Remove context in db calls - [`d7567fc`](https://github.com/netbirdio/netbird/commit/d7567fc54fc3eee2b54a6543b6c2f6a0772ff09d) adjust peer benchmark expectations ### 📊 Changes **7 files changed** (+59 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/golang-test-linux.yml` (+2 -2) 📝 `management/server/groups/manager.go` (+17 -22) 📝 `management/server/http/handlers/networks/resources_handler.go` (+15 -10) 📝 `management/server/http/handlers/peers/peers_handler.go` (+6 -6) 📝 `management/server/http/testing/benchmarks/peers_handler_benchmark_test.go` (+6 -6) 📝 `management/server/peer.go` (+8 -6) 📝 `management/server/store/sql_store.go` (+5 -5) </details> ### 📄 Description ## Describe your changes This is purely a performance improvement by counting the peers and resources in each group once per resource and reusing that map. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 05:06:15 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#19616