Skip to content

Commit

Permalink
Merge pull request #15 from keboola/adamvyborny-fix-another-memory-leak
Browse files Browse the repository at this point in the history
Fixed memory leak
  • Loading branch information
AdamVyborny authored Nov 24, 2022
2 parents fe26bb8 + f20483f commit 175abeb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Generator;
use Keboola\Component\UserException;
use Keboola\Utils\Exception\JsonDecodeException;
use MongoExtractor\Config\ExportOptions;
use Nette\Utils\Strings;
use Retry\BackOff\ExponentialBackOffPolicy;
Expand Down
3 changes: 1 addition & 2 deletions src/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use MongoDB\Driver\Manager;
use MongoExtractor\Config\Config;
use MongoExtractor\Config\ExportOptions;
use MongoExtractor\Config\OldConfigDefinition;
use Retry\BackOff\ExponentialBackOffPolicy;
use Retry\Policy\SimpleRetryPolicy;
use Retry\RetryProxy;
Expand Down Expand Up @@ -139,7 +138,7 @@ private function createSshTunnel(array $sshOptions): void
}

/**
* @param array<int, array{path: string, primaryKey: array<int, string>|string|null}> $manifestsData
* @param array<string, array{path: string, primaryKey: array<int, string>|string|null}> $manifestsData
*/
protected function generateManifests(array $manifestsData, ExportOptions $exportOptions): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(

/**
* Parses exported json and creates .csv and .manifest files
* @return array<int, array{path: string, primaryKey: array<int, string>|string}>
* @return array<string, array{path: string, primaryKey: array<int, string>|string}>
* @throws \Keboola\Csv\Exception
* @throws \Keboola\Csv\InvalidArgumentException
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Parser/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Mapping implements ParserInterface
private string $path;
private string $name;
private Filesystem $filesystem;
/** @var array<int, array{path: string, primaryKey: array<int, string>|string}> */
/** @var array<string, array{path: string, primaryKey: array<int, string>|string}> */
private array $manifestData = [];

/**
Expand Down Expand Up @@ -81,7 +81,7 @@ public function parse(array $data): void
throw new Exception('Failed write to file "' . $outputCsv . '"');
}

$this->manifestData[] = [
$this->manifestData[$outputCsv] = [
'path' => $outputCsv . '.manifest',
'primaryKey' => $file->getPrimaryKey(true),
];
Expand All @@ -105,7 +105,7 @@ protected function prependHeader(Table $file, string &$content): void
}

/**
* @return array<int, array{path: string, primaryKey: array<int, string>|string}>
* @return array<string, array{path: string, primaryKey: array<int, string>|string}>
*/
public function getManifestData(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Parser/ParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ interface ParserInterface
/** @param array<int, object> $data */
public function parse(array $data): void;

/** @return array<int, array{path: string, primaryKey: array<int, string>|string}> */
/** @return array<string, array{path: string, primaryKey: array<int, string>|string}> */
public function getManifestData(): array;
}
8 changes: 6 additions & 2 deletions src/Parser/Raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ private function writerRowToOutputFile(object $item): void
}

/**
* @return array<int, array{path: string, primaryKey: array<int, string>|string}>
* @return array<string, array{path: string, primaryKey: array<int, string>|string}>
*/
public function getManifestData(): array
{
return [['path' => $this->filename . '.manifest', 'primaryKey' => $this->setIdAsPrimaryKey ? ['id']: []]];
return [
$this->filename => [
'path' => $this->filename . '.manifest', 'primaryKey' => $this->setIdAsPrimaryKey ? ['id']: [],
],
];
}
}

0 comments on commit 175abeb

Please sign in to comment.