Fix race on updatesize (#5190)

* fix race on updatesize

* fix more repoPath
This commit is contained in:
Lunny Xiao 2018-10-26 17:37:57 +08:00 committed by Lauris BH
parent aeb5655c25
commit e7822473e9
2 changed files with 10 additions and 9 deletions

View file

@ -685,7 +685,7 @@ func (repo *Repository) IsOwnedBy(userID int64) bool {
}
func (repo *Repository) updateSize(e Engine) error {
repoInfoSize, err := git.GetRepoSize(repo.RepoPath())
repoInfoSize, err := git.GetRepoSize(repo.repoPath(e))
if err != nil {
return fmt.Errorf("UpdateSize: %v", err)
}
@ -1713,7 +1713,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
}
// Create/Remove git-daemon-export-ok for git-daemon...
daemonExportFile := path.Join(repo.RepoPath(), `git-daemon-export-ok`)
daemonExportFile := path.Join(repo.repoPath(e), `git-daemon-export-ok`)
if repo.IsPrivate && com.IsExist(daemonExportFile) {
if err = os.Remove(daemonExportFile); err != nil {
log.Error(4, "Failed to remove %s: %v", daemonExportFile, err)