Skip to content

Commit

Permalink
v2.5.1
Browse files Browse the repository at this point in the history
* Allow file details to change when asset nodes are updated
* Do not clear file_etag when enriching assets with s3 object
* Use guzzle retry middleware in `Triniti\Dam\AssetEnricher` instead of aws
  • Loading branch information
mtakla16 authored Feb 7, 2024
1 parent 18a1447 commit 5fcf09f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG-2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
This changelog references the relevant changes done in 2.x versions.


## v2.5.1
* Allow file details to change when asset nodes are updated
* Do not clear file_etag when enriching assets with s3 object
* Use guzzle retry middleware in `Triniti\Dam\AssetEnricher` instead of aws


## v2.5.0
* Require php 8.3.
* Allow symfony 7.x
Expand Down
6 changes: 0 additions & 6 deletions src/Dam/AssetAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ protected function enrichNodeUpdated(Message $event): void
/** @var Message $newNode */
$newNode = $event->get('new_node');

$newNode
// file details SHOULD not change
->set('mime_type', $oldNode->get('mime_type'))
->set('file_size', $oldNode->get('file_size'))
->set('file_etag', $oldNode->get('file_etag'));

// assets are only published, deleted, expired, enforce it.
if (NodeStatus::DELETED->value !== $newNode->fget('status')
&& NodeStatus::EXPIRED->value !== $newNode->fget('status')
Expand Down
11 changes: 2 additions & 9 deletions src/Dam/AssetEnricher.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

namespace Triniti\Dam;

use Aws\RetryMiddleware;
use Aws\S3\S3Client;
use Brick\Math\BigInteger;
use Gdbots\Pbjx\DependencyInjection\PbjxEnricher;
use Gdbots\Pbjx\Event\PbjxEvent;
use Gdbots\Pbjx\EventSubscriber;
use GuzzleHttp\RetryMiddleware;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Triniti\Schemas\Dam\AssetId;
Expand Down Expand Up @@ -57,13 +57,6 @@ public function enrichWithS3Object(PbjxEvent $pbjxEvent): void
if (!$schema->hasMixin('gdbots:pbjx:mixin:event')) {
return;
}

if ($schema->hasMixin('gdbots:ncr:mixin:node-created')
|| $schema->usesCurie('gdbots:ncr:event:node-created')
) {
// always try to get file_etag from s3 upon node creation
$asset->clear('file_etag');
}
}

if ($asset->has('file_etag')) {
Expand All @@ -82,7 +75,7 @@ public function enrichWithS3Object(PbjxEvent $pbjxEvent): void
'Bucket' => $this->bucket,
'Key' => $key,
'@http' => [
'delay' => $retries > 0 ? RetryMiddleware::exponentialDelay($retries) : 0,
'delay' => RetryMiddleware::exponentialDelay($retries),
],
]);
$asset
Expand Down

0 comments on commit 5fcf09f

Please sign in to comment.