Skip to content

Commit

Permalink
Fix performance issue, especially with remote filesystems (#41)
Browse files Browse the repository at this point in the history
Reduce the number of times the filesystem is accessed
  • Loading branch information
BartVB committed May 26, 2023
1 parent 8b86fab commit 51ac2ce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Listener/UserCoverRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ public function __invoke(UserSerializer $serializer, User $user): array
*/
public function thumbnailUrl(?string $imageName)
{
$thumbnailName = 'thumbnails/' . $imageName;

if ($this->coversDir->exists($thumbnailName) && !empty($imageName)) {
return $this->coversDir->url($thumbnailName);
if (empty($imageName) {
return null;
}

return null;

$thumbnailName = 'thumbnails/' . $imageName;
return $this->coversDir->url($thumbnailName);
}
}

0 comments on commit 51ac2ce

Please sign in to comment.