Avoid retry for 404 error
This commit is contained in:
parent
acd61fc084
commit
bce3f40a16
|
@ -6,6 +6,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/ente-io/museum/pkg/utils/array"
|
"github.com/ente-io/museum/pkg/utils/array"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -397,6 +398,13 @@ func (c *Controller) getEmbeddingObject(ctx context.Context, objectKey string, d
|
||||||
if fetchCtx.Err() != nil {
|
if fetchCtx.Err() != nil {
|
||||||
ctxLogger.Error("Fetch timed out or cancelled: ", fetchCtx.Err())
|
ctxLogger.Error("Fetch timed out or cancelled: ", fetchCtx.Err())
|
||||||
} else {
|
} else {
|
||||||
|
// check if the error is due to object not found
|
||||||
|
if s3Err, ok := err.(awserr.Error); ok {
|
||||||
|
if s3Err.Code() == s3.ErrCodeNoSuchKey {
|
||||||
|
ctxLogger.Warn("Object not found: ", s3Err)
|
||||||
|
return ente.EmbeddingObject{}, stacktrace.Propagate(errors.New("object not found"), "")
|
||||||
|
}
|
||||||
|
}
|
||||||
ctxLogger.Error("Failed to fetch object: ", err)
|
ctxLogger.Error("Failed to fetch object: ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue