Skip to content

Commit

Permalink
Merge pull request #290 from esmero/ISSUE-286
Browse files Browse the repository at this point in the history
ISSUE-286: Wrong variable substitution on new logs generated by multipart
  • Loading branch information
DiegoPino authored Dec 20, 2023
2 parents 6a5cde3 + 644b2ea commit 6e3824c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/StrawberryfieldFilePersisterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ public function copyOrPutS3Aware(string $source_uri, string $destination_uri) {
}
// Longer than the max Key for an S3 Object Path
if (mb_strlen(rtrim($destination_key, '/')) > 255) {
$this->loggerFactory->get('strawberryfield')->info('File !destination_uri will not be processed as S3 because the path is longer than 255 characters', ['!destination_uri' => $destination_uri]);
$this->loggerFactory->get('strawberryfield')->info('File @destination_uri will not be processed as S3 because the path is longer than 255 characters', ['@destination_uri' => $destination_uri]);
return FALSE;
}

Expand All @@ -1417,7 +1417,7 @@ public function copyOrPutS3Aware(string $source_uri, string $destination_uri) {
$objectCopierPromise = new \Aws\S3\ObjectCopier($client, ['Bucket' => $bucket, 'Key' => $source_key], ['Bucket' => $bucket, 'Key' => $destination_key], 'private', $options);
$result = $objectCopierPromise->copy();
$destination_wrapper->writeUriToCache($destination_uri);
$this->loggerFactory->get('strawberryfield')->info('File was successfully Copied to S3 at !destination_uri via Multipart', ['!destination_uri' => $destination_uri]);
$this->loggerFactory->get('strawberryfield')->info('File was successfully Copied to S3 at @destination_uri via Multipart', ['@destination_uri' => $destination_uri]);
return $destination_uri;
}
catch (\Aws\Exception\MultipartUploadException $e) {
Expand All @@ -1436,21 +1436,21 @@ public function copyOrPutS3Aware(string $source_uri, string $destination_uri) {
try {
$result = $objectUploaderPromise->upload();
if ($result["@metadata"]["statusCode"] == '200') {
$this->loggerFactory->get('strawberryfield')->info('File was successfully uploaded to S3 at %destination_uri via Multipart', ['%destination_uri' => $destination_uri]);
$this->loggerFactory->get('strawberryfield')->info('File was successfully uploaded to S3 at @destination_uri via Multipart', ['@destination_uri' => $destination_uri]);
}
// If the SDK chooses a multipart upload, try again if there is an exception.
// Unlike PutObject calls, multipart upload calls are not automatically retried.
}
catch (\Aws\Exception\MultipartUploadException $e) {
rewind($source);
$this->loggerFactory->get('strawberryfield')->warning('File failed uploading to S3 at %destination_uri via Multipart but we will try again', ['%destination_uri' => $destination_uri]);
$this->loggerFactory->get('strawberryfield')->warning('File failed uploading to S3 at @destination_uri via Multipart but we will try again', ['@destination_uri' => $destination_uri]);
try {
$uploader = new \Aws\S3\MultipartUploader($client, $source, [
'state' => $e->getState(),
]);
}
catch (\Exception $e) {
$this->loggerFactory->get('strawberryfield')->error('File failed uploading to S3 at %destination_uri from %source_uri via Multipart even if we retried', [
$this->loggerFactory->get('strawberryfield')->error('File failed uploading to S3 at @destination_uri from @source_uri via Multipart even if we retried', [
'%destination_uri' => $destination_uri,
'%source_uri' => $source_uri
]);
Expand Down

0 comments on commit 6e3824c

Please sign in to comment.