Skip to content

Commit

Permalink
CC-23323 Fixed typo in DataImport module. (#10671)
Browse files Browse the repository at this point in the history
CC-23323 Fixed typo in DataImport module.
  • Loading branch information
artem-png authored Dec 7, 2023
1 parent 47d36eb commit c0a9749
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
12 changes: 12 additions & 0 deletions src/Spryker/Shared/DataImport/DataImportConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,22 @@ interface DataImportConstants
*
* @api
*
* @deprecated Use {@link \Spryker\Shared\DataImport\DataImportConstants::BULK_MODE_MEMORY_THRESHOLD_PERCENT} instead.
*
* @var string
*/
public const BULK_MODE_MEMORY_THESHOLD_PERCENT = 'DATA_IMPORT:BULK_MODE_MEMORY_THESHOLD_PERCENT';

/**
* Specification:
* - Defines a percent from memory could be used for bulk import.
*
* @api
*
* @var string
*/
public const BULK_MODE_MEMORY_THRESHOLD_PERCENT = 'DATA_IMPORT:BULK_MODE_MEMORY_THRESHOLD_PERCENT';

/**
* Specification:
* - Root path to the import files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MemoryAllocatedElasticBatch implements ElasticBatchInterface
*
* @var int
*/
protected static $memoryTresholdPercent;
protected static $memoryThresholdPercent;

/**
* Calculated maximum memory quota to be filled.
Expand Down Expand Up @@ -87,7 +87,7 @@ public function __construct(SystemMemoryInterface $systemMemory, DataImportConfi
$this->systemMemory = $systemMemory;

static::$gradualityFactorCounter = $config->getBulkWriteGradualityFactor();
static::$memoryTresholdPercent = $config->getBulkWriteMemoryThesoldPercent();
static::$memoryThresholdPercent = $config->getBulkWriteMemoryThresholdPercent();
}

/**
Expand Down Expand Up @@ -251,7 +251,7 @@ protected function getGraduatedFractionMemoryQuota(): int
*/
protected function getMemoryLimitWithThreshold(): int
{
return (int)floor(static::$memoryTresholdPercent / 100 * $this->systemMemory->getMemoryLimit());
return (int)floor(static::$memoryThresholdPercent / 100 * $this->systemMemory->getMemoryLimit());
}

/**
Expand Down
22 changes: 20 additions & 2 deletions src/Spryker/Zed/DataImport/DataImportConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class DataImportConfig extends AbstractBundleConfig
/**
* @var int
*/
protected const BULK_MODE_MEMORY_THESHOLD_PERCENT = 30;
protected const BULK_MODE_MEMORY_THRESHOLD_PERCENT = 30;

/**
* @api
Expand Down Expand Up @@ -158,9 +158,27 @@ public function getBulkWriteGradualityFactor(): int
*
* @return int
*/
public function getBulkWriteMemoryThresholdPercent(): int
{
return $this->get(
DataImportConstants::BULK_MODE_MEMORY_THESHOLD_PERCENT,
$this->get(DataImportConstants::BULK_MODE_MEMORY_THRESHOLD_PERCENT, static::BULK_MODE_MEMORY_THRESHOLD_PERCENT),
);
}

/**
* Specification:
* - Returns memory threshold limit in percentage of total allowed memory.
*
* @api
*
* @deprecated Use {@link \Spryker\Zed\DataImport\DataImportConfig::getBulkWriteMemoryThresholdPercent()} instead.
*
* @return int
*/
public function getBulkWriteMemoryThesoldPercent(): int
{
return $this->get(DataImportConstants::BULK_MODE_MEMORY_THESHOLD_PERCENT, static::BULK_MODE_MEMORY_THESHOLD_PERCENT);
return $this->get(DataImportConstants::BULK_MODE_MEMORY_THESHOLD_PERCENT, static::BULK_MODE_MEMORY_THRESHOLD_PERCENT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function getConfigMock(int $bulkWriteGradualityFactor, int $memoryThre
$mocked->method('getBulkWriteGradualityFactor')
->willReturn($bulkWriteGradualityFactor);

$mocked->method('getBulkWriteMemoryThesoldPercent')
$mocked->method('getBulkWriteMemoryThresholdPercent')
->willReturn($memoryThresholdPercent);

return $mocked;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
*
* @SuppressWarnings(PHPMD)
* @SuppressWarnings(\SprykerTest\Zed\DataImport\PHPMD)
*/
class DataImportBusinessTester extends Actor
{
Expand Down

0 comments on commit c0a9749

Please sign in to comment.