Performance issue on adding user to team #4105

Closed
opened 2025-11-02 05:38:08 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @davidsvantesson on GitHub (Oct 12, 2019).

  • Gitea version (or commit ref): 1.9.4 (also 1.10.0+dev-414-gf1fdd782d)
  • Git version: not relevant
  • Operating system: ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

With the combination of many users and many repositories in a team, it can take very long time to add a single new team member. Example adding one user to team with ~100 members x 100 repositories: 160 seconds.

When adding a new team members the function recalculateTeamAccesses is run over all team's repositories. This function has to go through all collaborators and teams for the repository. So the time for adding a repository is something in the order of O(teams:users*repositories). It should be possible to only recalculate the access of the specific user that was added (or deleted) to the team for each repository, only giving O(repositories).

Originally created by @davidsvantesson on GitHub (Oct 12, 2019). - Gitea version (or commit ref): 1.9.4 (also 1.10.0+dev-414-gf1fdd782d) - Git version: not relevant - Operating system: ubuntu 18.04 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description With the combination of many users and many repositories in a team, it can take very long time to add a single new team member. Example adding one user to team with ~100 members x 100 repositories: 160 seconds. When adding a new team members the function recalculateTeamAccesses is run over all team's repositories. This function has to go through all collaborators and teams for the repository. So the time for adding a repository is something in the order of O(teams:users*repositories). It should be possible to only recalculate the access of the specific user that was added (or deleted) to the team for each repository, only giving O(repositories).
GiteaMirror added the type/enhancement label 2025-11-02 05:38:08 -06:00
Author
Owner

@jolheiser commented on GitHub (Oct 18, 2019):

Fixed by #8481

@jolheiser commented on GitHub (Oct 18, 2019): Fixed by #8481
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4105