This commit is contained in:
Neeraj Gupta 2024-05-16 16:10:51 +05:30
parent b404b77da3
commit 08555954d2

View file

@ -358,10 +358,9 @@ func (c *Controller) getEmbeddingObject(ctx context.Context, objectKey string, d
// check if the error is due to object not found
if s3Err, ok := err.(awserr.RequestFailure); ok {
if s3Err.Code() == s3.ErrCodeNoSuchKey {
if c.derivedStorageDataCenter == c.S3Config.GetHotBackblazeDC() {
ctxLogger.Error("Object not found: ", s3Err)
return ente.EmbeddingObject{}, stacktrace.Propagate(errors.New("object not found"), "")
} else {
if c.derivedStorageDataCenter != c.S3Config.GetHotBackblazeDC() {
// todo:(neeraj) Refactor this later to get available the DC from the DB and use that to
// copy the object to currently active DC for derived storage
// If derived and hot bucket are different, try to copy from hot bucket
copyEmbeddingObject, err := c.copyEmbeddingObject(ctx, objectKey, c.S3Config.GetHotBackblazeDC(), c.derivedStorageDataCenter)
if err == nil {
@ -371,6 +370,9 @@ func (c *Controller) getEmbeddingObject(ctx context.Context, objectKey string, d
ctxLogger.WithError(err).Error("Failed to copy from hot bucket object")
}
return ente.EmbeddingObject{}, stacktrace.Propagate(errors.New("object not found"), "")
} else {
ctxLogger.Error("Object not found: ", s3Err)
return ente.EmbeddingObject{}, stacktrace.Propagate(errors.New("object not found"), "")
}
}
}