-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move add to hook queue for created repo to outside xorm session. #7675
Changes from 2 commits
63d5de9
29fd11c
e7013ca
45ec777
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1332,7 +1332,6 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err | |
}); err != nil { | ||
return fmt.Errorf("prepareWebhooks: %v", err) | ||
} | ||
go HookQueue.Add(repo.ID) | ||
} else if err = repo.recalculateAccesses(e); err != nil { | ||
// Organization automatically called this in addRepository method. | ||
return fmt.Errorf("recalculateAccesses: %v", err) | ||
|
@@ -1402,7 +1401,17 @@ func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err | |
} | ||
} | ||
|
||
return repo, sess.Commit() | ||
err = sess.Commit() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Add to hook queue for created repo after session commit. | ||
if u.IsOrganization() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If commit fails repo won't be created There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error handling for session commit added. I do not know why amd64 build is failing after I added this commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's arm64, I think that's fail unrelated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I restarted build, it was amd64 fail first, now arm64. I restarted again, hopefully that fixes things. |
||
go HookQueue.Add(repo.ID) | ||
} | ||
|
||
return repo, err | ||
} | ||
|
||
func countRepositories(userID int64, private bool) int64 { | ||
|
@@ -2462,6 +2471,11 @@ func ForkRepository(doer, u *User, oldRepo *Repository, name, desc string) (_ *R | |
go HookQueue.Add(oldRepo.ID) | ||
} | ||
|
||
// Add to hook queue for created repo after session commit. | ||
if u.IsOrganization() { | ||
go HookQueue.Add(repo.ID) | ||
} | ||
|
||
if err = repo.UpdateSize(); err != nil { | ||
log.Error("Failed to update size for repository: %v", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.