Skip to content

Commit

Permalink
Rename var to max_filesize
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf authored Jun 27, 2024
1 parent 370d0f3 commit 10ac502
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/BackgroundJobs/GenerateMetadataJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
use Psr\Log\LoggerInterface;

class GenerateMetadataJob extends TimedJob {
// Default memory limit for metadata generation (256 MBytes).
protected const DEFAULT_MEMORY_LIMIT = 256;
// Default file size limit for metadata generation (MBytes).
protected const DEFAULT_MAX_FILESIZE = 256;

public function __construct(
ITimeFactory $time,
Expand Down Expand Up @@ -103,11 +103,12 @@ private function scanFolder(Folder $folder): void {
continue;
}

// Don't generate metadata for files bigger than metadata_max_memory
// Don't generate metadata for files bigger than configured metadata_max_filesize
// Files are loaded in memory so very big files can lead to an OOM on the server
$nodeSize = $node->getSize();
$memoryLimit = $this->config->getSystemValueInt('metadata_max_memory', self::DEFAULT_MEMORY_LIMIT);
if ($nodeSize > $memoryLimit * 1000000) {
$this->logger->debug("Skipping generating metadata for fileid " . $node->getId() . " as its size exceeds configured 'metadata_max_memory'.");
$nodeLimit = $this->config->getSystemValueInt('metadata_max_filesize', self::DEFAULT_MAX_FILESIZE);
if ($nodeSize > $nodeLimit * 1000000) {
$this->logger->debug("Skipping generating metadata for fileid " . $node->getId() . " as its size exceeds configured 'metadata_max_filesize'.");
continue;
}

Expand Down

0 comments on commit 10ac502

Please sign in to comment.