diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-02-22 13:31:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 13:31:37 +0800 |
commit | 182b9c193642838dd41bf26f0fe4b2e870770f7e (patch) | |
tree | 44bd7d909513093b69c2be13b456b92eb5ad0821 /services/agit | |
parent | d6811baf88ca6d58b92d4dc12b1f2a292198751f (diff) | |
download | gitea-182b9c193642838dd41bf26f0fe4b2e870770f7e.tar.gz gitea-182b9c193642838dd41bf26f0fe4b2e870770f7e.zip |
small cache when get user id on interation (#29296)
Diffstat (limited to 'services/agit')
-rw-r--r-- | services/agit/agit.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/services/agit/agit.go b/services/agit/agit.go index bc68372570..75b561581d 100644 --- a/services/agit/agit.go +++ b/services/agit/agit.go @@ -38,6 +38,11 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. _, forcePush = opts.GitPushOptions["force-push"] objectFormat, _ := gitRepo.GetObjectFormat() + pusher, err := user_model.GetUserByID(ctx, opts.UserID) + if err != nil { + return nil, fmt.Errorf("Failed to get user. Error: %w", err) + } + for i := range opts.OldCommitIDs { if opts.NewCommitIDs[i] == objectFormat.EmptyObjectID().String() { results = append(results, private.HookProcReceiveRefResult{ @@ -116,11 +121,6 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. description = opts.GitPushOptions["description"] } - pusher, err := user_model.GetUserByID(ctx, opts.UserID) - if err != nil { - return nil, fmt.Errorf("Failed to get user. Error: %w", err) - } - prIssue := &issues_model.Issue{ RepoID: repo.ID, Title: title, |