mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-27 00:42:16 +03:00
Fix genre update chunking
This commit is contained in:
parent
24fef584ad
commit
ad45ab4a04
@ -21,12 +21,12 @@ func (r *sqlRepository) updateGenres(id string, tableName string, genres model.G
|
|||||||
if len(genres) == 0 {
|
if len(genres) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ins := Insert(tableName+"_genres").Columns("genre_id", tableName+"_id")
|
|
||||||
var genreIds []string
|
var genreIds []string
|
||||||
for _, g := range genres {
|
for _, g := range genres {
|
||||||
genreIds = append(genreIds, g.ID)
|
genreIds = append(genreIds, g.ID)
|
||||||
}
|
}
|
||||||
err = utils.RangeByChunks(genreIds, 100, func(ids []string) error {
|
err = utils.RangeByChunks(genreIds, 100, func(ids []string) error {
|
||||||
|
ins := Insert(tableName+"_genres").Columns("genre_id", tableName+"_id")
|
||||||
for _, gid := range ids {
|
for _, gid := range ids {
|
||||||
ins = ins.Values(gid, id)
|
ins = ins.Values(gid, id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user