mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 18:14:28 +00:00
Move add to hook queue for created repo to outside xorm session. Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
This commit is contained in:
parent
9fbb898058
commit
93bac4e10d
@ -1324,7 +1324,6 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("prepareWebhooks: %v", err)
|
return fmt.Errorf("prepareWebhooks: %v", err)
|
||||||
}
|
}
|
||||||
go HookQueue.Add(repo.ID)
|
|
||||||
} else if err = repo.recalculateAccesses(e); err != nil {
|
} else if err = repo.recalculateAccesses(e); err != nil {
|
||||||
// Organization automatically called this in addRepository method.
|
// Organization automatically called this in addRepository method.
|
||||||
return fmt.Errorf("recalculateAccesses: %v", err)
|
return fmt.Errorf("recalculateAccesses: %v", err)
|
||||||
@ -1393,7 +1392,16 @@ func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return repo, sess.Commit()
|
if err = sess.Commit(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to hook queue for created repo after session commit.
|
||||||
|
if u.IsOrganization() {
|
||||||
|
go HookQueue.Add(repo.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
return repo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func countRepositories(userID int64, private bool) int64 {
|
func countRepositories(userID int64, private bool) int64 {
|
||||||
@ -2478,6 +2486,11 @@ func ForkRepository(doer, u *User, oldRepo *Repository, name, desc string) (_ *R
|
|||||||
go HookQueue.Add(oldRepo.ID)
|
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 {
|
if err = repo.UpdateSize(); err != nil {
|
||||||
log.Error("Failed to update size for repository: %v", err)
|
log.Error("Failed to update size for repository: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user