Browse Source

models/repo: fix SQLite3 database-lock when fail to delete repository (#4048)

pull/3809/merge
Unknwon 8 years ago
parent
commit
1863f38286
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 8
      models/repo.go

8
models/repo.go

@ -1414,6 +1414,10 @@ func DeleteRepository(uid, repoID int64) error {
return err
}
if err = sess.Commit(); err != nil {
return fmt.Errorf("Commit: %v", err)
}
// Remove repository files.
repoPath := repo.repoPath(sess)
RemoveAllWithNotice("Delete repository files", repoPath)
@ -1425,10 +1429,6 @@ func DeleteRepository(uid, repoID int64) error {
RemoveAllWithNotice("Delete attachment", attachmentPaths[i])
}
if err = sess.Commit(); err != nil {
return fmt.Errorf("Commit: %v", err)
}
if repo.NumForks > 0 {
if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)

Loading…
Cancel
Save