fix(07): CR-02 call cancel() explicitly after S3 Delete, not via defer
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
62edbca44e
commit
fbda7cbe5e
1 changed files with 1 additions and 1 deletions
|
|
@ -202,10 +202,10 @@ func FileUploadHandler(deps FilesDeps) http.HandlerFunc {
|
|||
slog.Default().Error("files upload: InsertTabloFile failed", "tablo_id", tablo.ID, "s3_key", s3Key, "err", err)
|
||||
// Best-effort S3 cleanup — orphan prevention until Phase 6 reconciler exists.
|
||||
cleanupCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
if delErr := deps.Files.Delete(cleanupCtx, s3Key); delErr != nil {
|
||||
slog.Default().Error("files upload: S3 cleanup after DB failure", "s3_key", s3Key, "err", delErr)
|
||||
}
|
||||
cancel() // call immediately after Delete, not via defer
|
||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue