Use db.WithTx/WithTx2 instead of TxContext when possible (#35130)
Some checks failed
cron-translations / crowdin-pull (push) Has been skipped
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-docker-rootful (push) Has been cancelled
release-nightly / nightly-docker-rootless (push) Has been cancelled

This commit is contained in:
Lunny Xiao
2025-07-23 01:02:01 +08:00
committed by GitHub
parent f201dde945
commit 65cd3f5309
56 changed files with 1999 additions and 2640 deletions

View File

@ -117,12 +117,6 @@ func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error) {
return nil
}
ctx, committer, err := db.TxContext(ctx)
if err != nil {
return err
}
defer committer.Close()
ids := make([]int64, len(uploads))
for i := range uploads {
ids[i] = uploads[i].ID
@ -131,10 +125,6 @@ func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error) {
return fmt.Errorf("delete uploads: %w", err)
}
if err = committer.Commit(); err != nil {
return err
}
for _, upload := range uploads {
localPath := upload.LocalPath()
isFile, err := util.IsFile(localPath)