forked from forgejo/forgejo
Add generic set type (#21408)
This PR adds a generic set type to get rid of maps used as sets. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
e84558b093
commit
0e57ff7eee
41 changed files with 328 additions and 324 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
@ -39,7 +40,7 @@ func renameExistingUserAvatarName(x *xorm.Engine) error {
|
|||
}
|
||||
log.Info("%d User Avatar(s) to migrate ...", count)
|
||||
|
||||
deleteList := make(map[string]struct{})
|
||||
deleteList := make(container.Set[string])
|
||||
start := 0
|
||||
migrated := 0
|
||||
for {
|
||||
|
@ -86,7 +87,7 @@ func renameExistingUserAvatarName(x *xorm.Engine) error {
|
|||
return fmt.Errorf("[user: %s] user table update: %v", user.LowerName, err)
|
||||
}
|
||||
|
||||
deleteList[filepath.Join(setting.Avatar.Path, oldAvatar)] = struct{}{}
|
||||
deleteList.Add(filepath.Join(setting.Avatar.Path, oldAvatar))
|
||||
migrated++
|
||||
select {
|
||||
case <-ticker.C:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue