FIX: Checked If File Exists Before Submitting Queue Job
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user