deploy: Don't treat a NotFound response for Delete as a fatal error.

This commit is contained in:
Robert van Gent 2021-04-28 20:32:19 -07:00 committed by Bjørn Erik Pedersen
parent 63cd05ce5a
commit f523e9f0fd

View file

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