-
-
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
Fix bugs when concurrent pushing packages #30335
base: main
Are you sure you want to change the base?
Conversation
I encountered a probelm which mentioned in https://github.com/go-gitea/gitea/pull/16510/files#r836054699 . Since there is no unique keys on |
defer tests.PrintCurrentTest(t)() | ||
|
||
var wg sync.WaitGroup | ||
for i := 0; i < 10; i++ { |
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.
I think this test is not correct - it should look like:
`
for i := 0; i < 10; i++ {
wg.Add(1)
go func(i int) {
putFile(t, fmt.Sprintf("/%s/%s.jar", packageVersion, strconv.Itoa(i)), "test", http.StatusCreated)
wg.Done()
}(i)
}
`
return nil, err | ||
} | ||
case setting.Database.Type.IsPostgreSQL(), setting.Database.Type.IsSQLite3(): | ||
if _, err := db.GetEngine(ctx).Exec("INSERT INTO package (owner_id,`type`,lower_name,name,semver_compatible) VALUES (?,?,?,?,?) ON CONFLICT (owner_id,`type`,lower_name) DO UPDATE SET lower_name=lower_name", |
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.
I think this line should look like:
"INSERT INTO package (owner_id,
type,lower_name,name,semver_compatible) VALUES (?,?,?,?,?) ON CONFLICT (owner_id,
type,lower_name) DO UPDATE SET lower_name=EXCLUDED.lower_name"
Fix #30171