fix: do not remove empty openid teams when none are present
continuous-integration/drone/push Build is passing Details

Maybe resolves https://community.vikunja.io/t/empty-openid-team-cleanup-cron-error-removing-empty-openid-team-database-is-locked-error-when-exporting-data/2306/3
This commit is contained in:
kolaente 2024-04-25 14:21:31 +02:00
parent 00a96663ba
commit 66e96322ea
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ func RemoveEmptySSOTeams(s *xorm.Session) (err error) {
return err
}
if len(teams) == 0 {
return nil
}
teamIDs := make([]int64, 0, len(teams))
for _, team := range teams {
teamIDs = append(teamIDs, team.ID)
@ -63,6 +67,6 @@ func RegisterEmptyOpenIDTeamCleanupCron() {
}
})
if err != nil {
log.Fatalf("Could not empty openid teams cleanup cron: %s", err)
log.Fatalf("Could not register empty openid teams cleanup cron: %s", err)
}
}