Skip to content

Commit

Permalink
deploy: Don't treat a NotFound response for Delete as a fatal error.
Browse files Browse the repository at this point in the history
  • Loading branch information
vangent authored and bep committed Apr 29, 2021
1 parent 63cd05c commit f523e9f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
_ "gocloud.dev/blob/fileblob" // import
_ "gocloud.dev/blob/gcsblob" // import
_ "gocloud.dev/blob/s3blob" // import
"gocloud.dev/gcerrors"
)

// Deployer supports deploying the site to target cloud providers.
Expand Down Expand Up @@ -238,9 +239,13 @@ func (d *Deployer) Deploy(ctx context.Context) error {
go func(del string) {
jww.INFO.Printf("Deleting %s...\n", del)
if err := bucket.Delete(ctx, del); err != nil {
errMu.Lock()
defer errMu.Unlock()
errs = append(errs, err)
if gcerrors.Code(err) == gcerrors.NotFound {
jww.WARN.Printf("Failed to delete %q because it wasn't found: %v", del, err)
} else {
errMu.Lock()
defer errMu.Unlock()
errs = append(errs, err)
}
}
<-sem
}(del)
Expand Down

0 comments on commit f523e9f

Please sign in to comment.