Slow performance on UI/API when adding/removing team in large organization #8752

Closed
opened 2025-11-02 08:16:28 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @IT-AlexKor on GitHub (Mar 26, 2022).

Description

Slow performance (7 minutes) on UI/API when adding/removing team in large organization (2000+ repos)

Steps to reproduce

  1. Create organization with 2000+ repos
  2. Create new team with:
  • Repository access = All repos
  • Permission = General access
  • Access to sections = all to Read
  • External Wiki/Issues = disabled
  1. Wait 7 minutes until it will be completed

Gitea Version

1.16.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.21.0

Operating System

CentOS Linux 7 (Core)

How are you running Gitea?

APP_NAME =
RUN_USER = git
RUN_MODE = prod

[security]
INTERNAL_TOKEN =
INSTALL_LOCK = true
SECRET_KEY =
PASSWORD_HASH_ALGO = pbkdf2
DISABLE_GIT_HOOKS = false

[database]
DB_TYPE = postgres
HOST =
NAME =
USER =
PASSWD =
SCHEMA =
SSL_MODE = disable
CHARSET = utf8
PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = false

[repository]
ROOT = /var/lib/gitea/data/gitea-repositories

[server]
SSH_DOMAIN =
DOMAIN =
HTTP_PORT = 3000
ROOT_URL =
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET =
OFFLINE_MODE = false

[lfs]
PATH = /var/lib/gitea/data/lfs

[mailer]
ENABLED = true
HOST =
FROM =
USER =
PASSWD =

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = true
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = true
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
ENABLE_TIMETRACKING = false
DEFAULT_ENABLE_TIMETRACKING = false
NO_REPLY_ADDRESS = noreply.localhost

[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true

[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false

[session]
PROVIDER = file

[log]
MODE = file,console
LEVEL = info
ROOT_PATH = /var/lib/gitea/log
ROUTER = console,file

[metrics]
ENABLED = true

[mirror]
MIN_INTERVAL = 1m

[indexer]
ISSUE_INDEXER_TYPE = elasticsearch
ISSUE_INDEXER_CONN_STR = http://
ISSUE_INDEXER_NAME = gitea_issues
ISSUE_INDEXER_PATH = indexers/issues.bleve
REPO_INDEXER_ENABLED = true
REPO_INDEXER_TYPE = elasticsearch
REPO_INDEXER_CONN_STR = http://
REPO_INDEXER_NAME = gitea_codes
REPO_INDEXER_PATH = indexers/repos.bleve
UPDATE_BUFFER_LEN = 20
MAX_FILE_SIZE = 1048576
REPO_INDEXER_INCLUDE =
REPO_INDEXER_EXCLUDE = resources/bin/**
STARTUP_TIMEOUT = 30s

[git.timeout]
MIGRATE = 1800
MIRROR = 600

Database

PostgreSQL

Originally created by @IT-AlexKor on GitHub (Mar 26, 2022). ### Description Slow performance (7 minutes) on UI/API when adding/removing team in large organization (2000+ repos) Steps to reproduce 1) Create organization with 2000+ repos 2) Create new team with: * Repository access = All repos * Permission = General access * Access to sections = all to Read * External Wiki/Issues = disabled 3) Wait 7 minutes until it will be completed ### Gitea Version 1.16.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.21.0 ### Operating System CentOS Linux 7 (Core) ### How are you running Gitea? APP_NAME = <ERASED> RUN_USER = git RUN_MODE = prod [security] INTERNAL_TOKEN = <ERASED> INSTALL_LOCK = true SECRET_KEY = <ERASED> PASSWORD_HASH_ALGO = pbkdf2 DISABLE_GIT_HOOKS = false [database] DB_TYPE = postgres HOST = <ERASED> NAME = <ERASED> USER = <ERASED> PASSWD = <ERASED> SCHEMA = SSL_MODE = disable CHARSET = utf8 PATH = /var/lib/gitea/data/gitea.db LOG_SQL = false [repository] ROOT = /var/lib/gitea/data/gitea-repositories [server] SSH_DOMAIN = <ERASED> DOMAIN = <ERASED> HTTP_PORT = 3000 ROOT_URL = <ERASED> DISABLE_SSH = false SSH_PORT = 22 LFS_START_SERVER = true LFS_JWT_SECRET = <ERASED> OFFLINE_MODE = false [lfs] PATH = /var/lib/gitea/data/lfs [mailer] ENABLED = true HOST = <ERASED> FROM = <ERASED> USER = PASSWD = [service] REGISTER_EMAIL_CONFIRM = false ENABLE_NOTIFY_MAIL = true DISABLE_REGISTRATION = true ALLOW_ONLY_EXTERNAL_REGISTRATION = false ENABLE_CAPTCHA = false REQUIRE_SIGNIN_VIEW = true DEFAULT_KEEP_EMAIL_PRIVATE = false DEFAULT_ALLOW_CREATE_ORGANIZATION = false ENABLE_TIMETRACKING = false DEFAULT_ENABLE_TIMETRACKING = false NO_REPLY_ADDRESS = noreply.localhost [picture] DISABLE_GRAVATAR = false ENABLE_FEDERATED_AVATAR = true [openid] ENABLE_OPENID_SIGNIN = false ENABLE_OPENID_SIGNUP = false [session] PROVIDER = file [log] MODE = file,console LEVEL = info ROOT_PATH = /var/lib/gitea/log ROUTER = console,file [metrics] ENABLED = true [mirror] MIN_INTERVAL = 1m [indexer] ISSUE_INDEXER_TYPE = elasticsearch ISSUE_INDEXER_CONN_STR = http://<ERASED> ISSUE_INDEXER_NAME = gitea_issues ISSUE_INDEXER_PATH = indexers/issues.bleve REPO_INDEXER_ENABLED = true REPO_INDEXER_TYPE = elasticsearch REPO_INDEXER_CONN_STR = http://<ERASED> REPO_INDEXER_NAME = gitea_codes REPO_INDEXER_PATH = indexers/repos.bleve UPDATE_BUFFER_LEN = 20 MAX_FILE_SIZE = 1048576 REPO_INDEXER_INCLUDE = REPO_INDEXER_EXCLUDE = resources/bin/** STARTUP_TIMEOUT = 30s [git.timeout] MIGRATE = 1800 MIRROR = 600 ### Database PostgreSQL
GiteaMirror added the performance/speed label 2025-11-02 08:16:28 -06:00
Author
Owner

@IT-AlexKor commented on GitHub (Mar 27, 2022):

part of logs

2022/03/27 07:10:30 models/org_team.go:559:NewTeam() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [10] - 1.923491ms
2022/03/27 07:10:30 models/org_team.go:571:NewTeam() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) AND (lower_name=$2) LIMIT 1 [10 test2] - 1.642934ms
2022/03/27 07:10:30 modules/web/route.go:74:func1() [I] [SQL] BEGIN TRANSACTION [] - 678.883µs
2022/03/27 07:10:30 models/org_team.go:585:NewTeam() [I] [SQL] INSERT INTO "team" ("org_id","lower_name","name","description","authorize","num_repos","num_members","includes_all_repositories","can_create_org_repo") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING "id" [10 test2 test2  read 0 0 true false] - 1.778583ms
2022/03/27 07:10:30 models/org_team.go:594:NewTeam() [I] [SQL] INSERT INTO "team_unit" ("org_id","team_id","type","access_mode") VALUES ($1, $2, $3, $4),($5, $6, $7, $8),($9, $10, $11, $12),($13, $14, $15, $16),($17, $18, $19, $20),($21, $22, $23, $24) [10 17 TypePullRequests read 10 17 TypeWiki read 10 17 TypeIssues read 10 17 TypeReleases read 10 17 TypeCode read 10 17 TypeProjects read] - 2.037851ms
2022/03/27 07:10:30 models/org_team.go:322:addAllRepositories() [I] [SQL] SELECT "id", "owner_id", "owner_name", "lower_name", "name", "description", "website", "original_service_type", "original_url", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "num_projects", "num_closed_projects", "is_private", "is_empty", "is_archived", "is_mirror", "status", "is_fork", "fork_id", "is_template", "template_id", "size", "is_fsck_enabled", "close_issues_via_commit_in_any_branch", "topics", "trust_model", "avatar", "created_unix", "updated_unix" FROM "repository" WHERE (owner_id = $1) [10] - 2.212123ms
2022/03/27 07:10:30 models/org_team.go:1059:hasTeamRepo() [I] [SQL] SELECT "id", "org_id", "team_id", "repo_id" FROM "team_repo" WHERE (org_id=$1) AND (team_id=$2) AND (repo_id=$3) LIMIT 1 [10 17 32] - 1.95135ms
2022/03/27 07:10:30 models/org_team.go:288:addRepository() [I] [SQL] INSERT INTO "team_repo" ("org_id","team_id","repo_id") VALUES ($1,$2,$3) RETURNING "id" [10 17 32] - 3.289803ms
2022/03/27 07:10:30 models/org_team.go:601:NewTeam() [I] [SQL] UPDATE "team" SET "num_repos" = "num_repos" + $1 WHERE "id"=$2 [1 17] - 1.765362ms
2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [10] - 2.031241ms
2022/03/27 07:10:30 ...epo_collaboration.go:77:getCollaborations() [I] [SQL] SELECT "id", "repo_id", "user_id", "mode", "created_unix", "updated_unix" FROM "collaboration" WHERE "repo_id"=$1 [32] - 1.872712ms
2022/03/27 07:10:30 models/org.go:76:loadTeams() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) ORDER BY CASE WHEN name LIKE 'Owners' THEN '' ELSE name END [10] - 1.67892ms
2022/03/27 07:10:30 models/org_team.go:843:getTeamUsersByTeamID() [I] [SQL] SELECT "id", "org_id", "team_id", "uid" FROM "team_user" WHERE (team_id=$1) [2] - 1.588638ms
2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [7] - 1.857002ms
2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [262] - 1.78526ms
2022/03/27 07:10:30 models/org_team.go:1059:hasTeamRepo() [I] [SQL] SELECT "id", "org_id", "team_id", "repo_id" FROM "team_repo" WHERE (org_id=$1) AND (team_id=$2) AND (repo_id=$3) LIMIT 1 [10 3 32] - 1.463163ms
2022/03/27 07:10:30 models/org_team.go:843:getTeamUsersByTeamID() [I] [SQL] SELECT "id", "org_id", "team_id", "uid" FROM "team_user" WHERE (team_id=$1) [3] - 1.339075ms
2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [6] - 1.723641ms
...GetUserByIDEngine() repeated few times
... blocks from models/org_team.go:1059:hasTeamRepo() to models/user/user.go:955:GetUserByIDEngine() repeated few times
2022/03/27 07:10:30 models/org_team.go:298:addRepository() [I] [SQL] DELETE FROM "access" WHERE "repo_id"=$1 [32] - 8.790967ms
2022/03/27 07:10:30 models/access.go:178:recalculateTeamAccesses() [I] [SQL] INSERT INTO "access" ("user_id","repo_id","mode") VALUES ($1, $2, $3),($4, $5, $6),($7, $8, $9),($10, $11, $12),($13, $14, $15),($16, $17, $18),($19, $20, $21),($22, $23, $24),($25, $26, $27),($28, $29, $30),($31, $32, $33),($34, $35, $36),($37, $38, $39),($40, $41, $42),($43, $44, $45),($46, $47, $48),($49, $50, $51),($52, $53, $54),($55, $56, $57),($58, $59, $60),($61, $62, $63),($64, $65, $66),($67, $68, $69),($70, $71, $72),($73, $74, $75),($76, $77, $78),($79, $80, $81),($82, $83, $84),($85, $86, $87),($88, $89, $90),($91, $92, $93),($94, $95, $96),($97, $98, $99),($100, $101, $102) [7 32 owner 262 32 owner 317 32 admin 108 32 admin 264 32 admin 30 32 write 13 32 admin 8 32 admin 281 32 admin 176 32 admin 106 32 admin 14 32 admin 204 32 admin 198 32 admin 255 32 admin 26 32 admin 49 32 admin 1 32 admin 46 32 admin 304 32 admin 331 32 admin 369 32 admin 298 32 admin 279 32 admin 197 32 admin 6 32 admin 302 32 admin 358 32 admin 27 32 admin 370 32 admin 329 32 admin 374 32 admin 335 32 admin 31 32 write] - 5.390659ms
2022/03/27 07:10:30 models/org_team.go:288:addRepository() [I] [SQL] INSERT INTO "team_repo" ("org_id","team_id","repo_id") VALUES ($1,$2,$3) RETURNING "id" [10 17 33] - 1.703373ms
2022/03/27 07:10:30 models/org_team.go:601:NewTeam() [I] [SQL] UPDATE "team" SET "num_repos" = "num_repos" + $1 WHERE "id"=$2 [1 17] - 1.454182ms
2022/03/27 07:10:30 ...epo_collaboration.go:77:getCollaborations() [I] [SQL] SELECT "id", "repo_id", "user_id", "mode", "created_unix", "updated_unix" FROM "collaboration" WHERE "repo_id"=$1 [33] - 1.712596ms
2022/03/27 07:10:30 models/org.go:76:loadTeams() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) ORDER BY CASE WHEN name LIKE 'Owners' THEN '' ELSE name END [10] - 1.876092ms
...
... block from  models/org_team.go:298:addRepository() to models/org.go:76:loadTeams() repeated many times
... plus sometimes repeats blocks from from models/org_team.go:1059:hasTeamRepo() to models/user/user.go:955:GetUserByIDEngine() repeated few times
...
2022/03/27 07:18:45 models/org_team.go:298:addRepository() [I] [SQL] DELETE FROM "access" WHERE "repo_id"=$1 [1088] - 21.228713ms
2022/03/27 07:18:45 models/access.go:178:recalculateTeamAccesses() [I] [SQL] INSERT INTO "access" ("user_id","repo_id","mode") VALUES ($1, $2, $3),($4, $5, $6),($7, $8, $9),($10, $11, $12),($13, $14, $15),($16, $17, $18),($19, $20, $21),($22, $23, $24),($25, $26, $27),($28, $29, $30),($31, $32, $33),($34, $35, $36),($37, $38, $39),($40, $41, $42),($43, $44, $45),($46, $47, $48),($49, $50, $51),($52, $53, $54),($55, $56, $57),($58, $59, $60),($61, $62, $63),($64, $65, $66),($67, $68, $69),($70, $71, $72),($73, $74, $75),($76, $77, $78),($79, $80, $81),($82, $83, $84),($85, $86, $87),($88, $89, $90),($91, $92, $93),($94, $95, $96),($97, $98, $99),($100, $101, $102) [329 1088 admin 281 1088 admin 198 1088 admin 374 1088 admin 26 1088 admin 176 1088 admin 7 1088 owner 1 1088 admin 14 1088 admin 46 1088 admin 255 1088 admin 8 1088 admin 298 1088 admin 304 1088 admin 197 1088 admin 30 1088 write 370 1088 admin 279 1088 admin 369 1088 admin 49 1088 admin 6 1088 admin 358 1088 admin 204 1088 admin 108 1088 admin 302 1088 admin 335 1088 admin 262 1088 owner 13 1088 admin 27 1088 admin 317 1088 admin 331 1088 admin 106 1088 admin 264 1088 admin 31 1088 write] - 3.260081ms

2022/03/27 07:18:45 ...ers/web/org/teams.go:291:NewTeamPost() [I] [SQL] UPDATE "user" SET num_teams=num_teams+1 WHERE id = $1 [10] - 2.399483ms
2022/03/27 07:18:45 ...c/net/http/server.go:2047:ServeHTTP() [I] [SQL] COMMIT [] - 1.989073ms
2022/03/27 07:18:45 ...ers/web/org/teams.go:301:NewTeamPost() [T] Team created: <ERASED>/test2
@IT-AlexKor commented on GitHub (Mar 27, 2022): part of logs ``` 2022/03/27 07:10:30 models/org_team.go:559:NewTeam() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [10] - 1.923491ms 2022/03/27 07:10:30 models/org_team.go:571:NewTeam() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) AND (lower_name=$2) LIMIT 1 [10 test2] - 1.642934ms 2022/03/27 07:10:30 modules/web/route.go:74:func1() [I] [SQL] BEGIN TRANSACTION [] - 678.883µs 2022/03/27 07:10:30 models/org_team.go:585:NewTeam() [I] [SQL] INSERT INTO "team" ("org_id","lower_name","name","description","authorize","num_repos","num_members","includes_all_repositories","can_create_org_repo") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING "id" [10 test2 test2 read 0 0 true false] - 1.778583ms 2022/03/27 07:10:30 models/org_team.go:594:NewTeam() [I] [SQL] INSERT INTO "team_unit" ("org_id","team_id","type","access_mode") VALUES ($1, $2, $3, $4),($5, $6, $7, $8),($9, $10, $11, $12),($13, $14, $15, $16),($17, $18, $19, $20),($21, $22, $23, $24) [10 17 TypePullRequests read 10 17 TypeWiki read 10 17 TypeIssues read 10 17 TypeReleases read 10 17 TypeCode read 10 17 TypeProjects read] - 2.037851ms 2022/03/27 07:10:30 models/org_team.go:322:addAllRepositories() [I] [SQL] SELECT "id", "owner_id", "owner_name", "lower_name", "name", "description", "website", "original_service_type", "original_url", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "num_projects", "num_closed_projects", "is_private", "is_empty", "is_archived", "is_mirror", "status", "is_fork", "fork_id", "is_template", "template_id", "size", "is_fsck_enabled", "close_issues_via_commit_in_any_branch", "topics", "trust_model", "avatar", "created_unix", "updated_unix" FROM "repository" WHERE (owner_id = $1) [10] - 2.212123ms 2022/03/27 07:10:30 models/org_team.go:1059:hasTeamRepo() [I] [SQL] SELECT "id", "org_id", "team_id", "repo_id" FROM "team_repo" WHERE (org_id=$1) AND (team_id=$2) AND (repo_id=$3) LIMIT 1 [10 17 32] - 1.95135ms 2022/03/27 07:10:30 models/org_team.go:288:addRepository() [I] [SQL] INSERT INTO "team_repo" ("org_id","team_id","repo_id") VALUES ($1,$2,$3) RETURNING "id" [10 17 32] - 3.289803ms 2022/03/27 07:10:30 models/org_team.go:601:NewTeam() [I] [SQL] UPDATE "team" SET "num_repos" = "num_repos" + $1 WHERE "id"=$2 [1 17] - 1.765362ms 2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [10] - 2.031241ms 2022/03/27 07:10:30 ...epo_collaboration.go:77:getCollaborations() [I] [SQL] SELECT "id", "repo_id", "user_id", "mode", "created_unix", "updated_unix" FROM "collaboration" WHERE "repo_id"=$1 [32] - 1.872712ms 2022/03/27 07:10:30 models/org.go:76:loadTeams() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) ORDER BY CASE WHEN name LIKE 'Owners' THEN '' ELSE name END [10] - 1.67892ms 2022/03/27 07:10:30 models/org_team.go:843:getTeamUsersByTeamID() [I] [SQL] SELECT "id", "org_id", "team_id", "uid" FROM "team_user" WHERE (team_id=$1) [2] - 1.588638ms 2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [7] - 1.857002ms 2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [262] - 1.78526ms 2022/03/27 07:10:30 models/org_team.go:1059:hasTeamRepo() [I] [SQL] SELECT "id", "org_id", "team_id", "repo_id" FROM "team_repo" WHERE (org_id=$1) AND (team_id=$2) AND (repo_id=$3) LIMIT 1 [10 3 32] - 1.463163ms 2022/03/27 07:10:30 models/org_team.go:843:getTeamUsersByTeamID() [I] [SQL] SELECT "id", "org_id", "team_id", "uid" FROM "team_user" WHERE (team_id=$1) [3] - 1.339075ms 2022/03/27 07:10:30 models/user/user.go:955:GetUserByIDEngine() [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "email_notifications_preference", "passwd", "passwd_hash_algo", "must_change_password", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "language", "description", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "is_restricted", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "num_teams", "num_members", "visibility", "repo_admin_change_team_access", "diff_view_style", "theme", "keep_activity_private" FROM "user" WHERE "id"=$1 LIMIT 1 [6] - 1.723641ms ...GetUserByIDEngine() repeated few times ... blocks from models/org_team.go:1059:hasTeamRepo() to models/user/user.go:955:GetUserByIDEngine() repeated few times 2022/03/27 07:10:30 models/org_team.go:298:addRepository() [I] [SQL] DELETE FROM "access" WHERE "repo_id"=$1 [32] - 8.790967ms 2022/03/27 07:10:30 models/access.go:178:recalculateTeamAccesses() [I] [SQL] INSERT INTO "access" ("user_id","repo_id","mode") VALUES ($1, $2, $3),($4, $5, $6),($7, $8, $9),($10, $11, $12),($13, $14, $15),($16, $17, $18),($19, $20, $21),($22, $23, $24),($25, $26, $27),($28, $29, $30),($31, $32, $33),($34, $35, $36),($37, $38, $39),($40, $41, $42),($43, $44, $45),($46, $47, $48),($49, $50, $51),($52, $53, $54),($55, $56, $57),($58, $59, $60),($61, $62, $63),($64, $65, $66),($67, $68, $69),($70, $71, $72),($73, $74, $75),($76, $77, $78),($79, $80, $81),($82, $83, $84),($85, $86, $87),($88, $89, $90),($91, $92, $93),($94, $95, $96),($97, $98, $99),($100, $101, $102) [7 32 owner 262 32 owner 317 32 admin 108 32 admin 264 32 admin 30 32 write 13 32 admin 8 32 admin 281 32 admin 176 32 admin 106 32 admin 14 32 admin 204 32 admin 198 32 admin 255 32 admin 26 32 admin 49 32 admin 1 32 admin 46 32 admin 304 32 admin 331 32 admin 369 32 admin 298 32 admin 279 32 admin 197 32 admin 6 32 admin 302 32 admin 358 32 admin 27 32 admin 370 32 admin 329 32 admin 374 32 admin 335 32 admin 31 32 write] - 5.390659ms 2022/03/27 07:10:30 models/org_team.go:288:addRepository() [I] [SQL] INSERT INTO "team_repo" ("org_id","team_id","repo_id") VALUES ($1,$2,$3) RETURNING "id" [10 17 33] - 1.703373ms 2022/03/27 07:10:30 models/org_team.go:601:NewTeam() [I] [SQL] UPDATE "team" SET "num_repos" = "num_repos" + $1 WHERE "id"=$2 [1 17] - 1.454182ms 2022/03/27 07:10:30 ...epo_collaboration.go:77:getCollaborations() [I] [SQL] SELECT "id", "repo_id", "user_id", "mode", "created_unix", "updated_unix" FROM "collaboration" WHERE "repo_id"=$1 [33] - 1.712596ms 2022/03/27 07:10:30 models/org.go:76:loadTeams() [I] [SQL] SELECT "id", "org_id", "lower_name", "name", "description", "authorize", "num_repos", "num_members", "includes_all_repositories", "can_create_org_repo" FROM "team" WHERE (org_id=$1) ORDER BY CASE WHEN name LIKE 'Owners' THEN '' ELSE name END [10] - 1.876092ms ... ... block from models/org_team.go:298:addRepository() to models/org.go:76:loadTeams() repeated many times ... plus sometimes repeats blocks from from models/org_team.go:1059:hasTeamRepo() to models/user/user.go:955:GetUserByIDEngine() repeated few times ... 2022/03/27 07:18:45 models/org_team.go:298:addRepository() [I] [SQL] DELETE FROM "access" WHERE "repo_id"=$1 [1088] - 21.228713ms 2022/03/27 07:18:45 models/access.go:178:recalculateTeamAccesses() [I] [SQL] INSERT INTO "access" ("user_id","repo_id","mode") VALUES ($1, $2, $3),($4, $5, $6),($7, $8, $9),($10, $11, $12),($13, $14, $15),($16, $17, $18),($19, $20, $21),($22, $23, $24),($25, $26, $27),($28, $29, $30),($31, $32, $33),($34, $35, $36),($37, $38, $39),($40, $41, $42),($43, $44, $45),($46, $47, $48),($49, $50, $51),($52, $53, $54),($55, $56, $57),($58, $59, $60),($61, $62, $63),($64, $65, $66),($67, $68, $69),($70, $71, $72),($73, $74, $75),($76, $77, $78),($79, $80, $81),($82, $83, $84),($85, $86, $87),($88, $89, $90),($91, $92, $93),($94, $95, $96),($97, $98, $99),($100, $101, $102) [329 1088 admin 281 1088 admin 198 1088 admin 374 1088 admin 26 1088 admin 176 1088 admin 7 1088 owner 1 1088 admin 14 1088 admin 46 1088 admin 255 1088 admin 8 1088 admin 298 1088 admin 304 1088 admin 197 1088 admin 30 1088 write 370 1088 admin 279 1088 admin 369 1088 admin 49 1088 admin 6 1088 admin 358 1088 admin 204 1088 admin 108 1088 admin 302 1088 admin 335 1088 admin 262 1088 owner 13 1088 admin 27 1088 admin 317 1088 admin 331 1088 admin 106 1088 admin 264 1088 admin 31 1088 write] - 3.260081ms 2022/03/27 07:18:45 ...ers/web/org/teams.go:291:NewTeamPost() [I] [SQL] UPDATE "user" SET num_teams=num_teams+1 WHERE id = $1 [10] - 2.399483ms 2022/03/27 07:18:45 ...c/net/http/server.go:2047:ServeHTTP() [I] [SQL] COMMIT [] - 1.989073ms 2022/03/27 07:18:45 ...ers/web/org/teams.go:301:NewTeamPost() [T] Team created: <ERASED>/test2 ```
Author
Owner

@lunny commented on GitHub (Jul 1, 2023):

I think this has been resolved by #19227

@lunny commented on GitHub (Jul 1, 2023): I think this has been resolved by #19227
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8752