FIX: Checked If File Exists Before Submitting Queue Job

This commit is contained in:
FahdShalhoub
2026-08-26 18:45:32 +03:00
parent cb3ab1f442
commit 858b277c9d
2 changed files with 12 additions and 21 deletions
+3 -7
View File
@@ -14,7 +14,7 @@ var S3Client S3
type S3 interface {
GetPresignedURL(ctx context.Context, key, contentType string, expiry time.Duration) (string, error)
DoesFileExist(ctx context.Context, key string) (bool, error)
DoesFileExist(ctx context.Context, key string) bool
}
type S3Concrete struct {
@@ -37,17 +37,13 @@ func (svc S3Concrete) GetPresignedURL(ctx context.Context, key, contentType stri
return request.URL, nil
}
func (svc S3Concrete) DoesFileExist(ctx context.Context, key string) (bool, error) {
func (svc S3Concrete) DoesFileExist(ctx context.Context, key string) bool {
_, error := svc.S3Client.HeadObject(ctx, &s3.HeadObjectInput{
Bucket: &svc.Bucket,
Key: &key,
})
if error != nil {
return false, error
}
return true, nil
return error != nil
}
// AssertSuccessfulConnection verifies that the bucket is reachable and that