Skip to content

Commit

Permalink
small cache when get user id on interation (#29296)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Feb 22, 2024
1 parent d6811ba commit 182b9c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions services/agit/agit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 182b9c1

Please sign in to comment.