Skip to content

Commit 182b9c1

Browse files
authored
small cache when get user id on interation (#29296)
1 parent d6811ba commit 182b9c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

services/agit/agit.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
3838
_, forcePush = opts.GitPushOptions["force-push"]
3939
objectFormat, _ := gitRepo.GetObjectFormat()
4040

41+
pusher, err := user_model.GetUserByID(ctx, opts.UserID)
42+
if err != nil {
43+
return nil, fmt.Errorf("Failed to get user. Error: %w", err)
44+
}
45+
4146
for i := range opts.OldCommitIDs {
4247
if opts.NewCommitIDs[i] == objectFormat.EmptyObjectID().String() {
4348
results = append(results, private.HookProcReceiveRefResult{
@@ -116,11 +121,6 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
116121
description = opts.GitPushOptions["description"]
117122
}
118123

119-
pusher, err := user_model.GetUserByID(ctx, opts.UserID)
120-
if err != nil {
121-
return nil, fmt.Errorf("Failed to get user. Error: %w", err)
122-
}
123-
124124
prIssue := &issues_model.Issue{
125125
RepoID: repo.ID,
126126
Title: title,

0 commit comments

Comments
 (0)