-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Description
- Gitea version (or commit ref): c6fb7fe
Description
The changes introduced in #7898 simply don't work, because if xorm.Session.Insert()
returns any errors, the session becomes invalidated, so subsequent attempts fail with:
newIssue: pq: current transaction is aborted, commands ignored until end of transaction block
Lines 1108 to 1122 in c6fb7fe
// There's no good way to identify a duplicate key error in database/sql; brute force some retries | |
dupIndexAttempts := issueMaxDupIndexAttempts | |
for { | |
_, err := e.SetExpr("`index`", "coalesce(MAX(`index`),0)+1"). | |
Where("repo_id=?", opts.Issue.RepoID). | |
Insert(opts.Issue) | |
if err == nil { | |
break | |
} | |
dupIndexAttempts-- | |
if dupIndexAttempts <= 0 { | |
return err | |
} | |
} |
I'm sorry, after so many attempts to solve the potential duplicate index
, we're back to square zero.
@lunny how would you like to handle this?