4444 * @SuppressWarnings(PHPMD.MissingImport)
4545 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
4646 */
47- #[AsCommand(name: 'factfinder:product- data:export ' )]
48- class ProductDataExportCommand extends Command
47+ #[AsCommand(name: 'factfinder:data:worker- export ' )]
48+ class WorkerDataExportCommand extends Command
4949{
5050 public const SALES_CHANNEL_ARGUMENT = 'sales_channel ' ;
5151 public const SALES_CHANNEL_LANGUAGE_ARGUMENT = 'language ' ;
@@ -105,6 +105,9 @@ public function configure(): void
105105 /**
106106 * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
107107 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
108+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
109+ * @SuppressWarnings(PHPMD.NPathComplexity)
110+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
108111 */
109112 public function execute (InputInterface $ input , OutputInterface $ output ): int
110113 {
@@ -191,18 +194,18 @@ public function execute(InputInterface $input, OutputInterface $output): int
191194 break ;
192195 }
193196
194- $ workerMemory = $ result [ ' memory ' ] ?? 0 ;
195- $ workerPeak = $ result ['peak ' ] ?? 0 ;
196- $ masterPeak = memory_get_peak_usage ( true ) / 1024 / 1024 ;
197-
198- $ output ->writeln (sprintf (
199- '[%s] Offset: %d | Worker Peak : %.2f MB | Worker Final: %.2f MB | MASTER PEAK : %.2f MB ' ,
200- date ('H:i:s ' ),
201- $ offset ,
202- $ workerPeak ,
203- $ workerMemory ,
204- $ masterPeak
205- ));
197+ // Uncomment if you want to debug memory consumption for each batch
198+ // $workerMemory = $result['memory '] ?? 0;
199+ // $workerPeak = $result['peak'] ?? 0 ;
200+ // $masterPeak = memory_get_peak_usage(true) / 1024 / 1024;
201+ // $output->writeln(sprintf(
202+ // '[%s] Offset: %d | Worker: %.2f MB | Worker Final: %.2f MB | MASTER: %.2f MB',
203+ // date('H:i:s'),
204+ // $offset,
205+ // $workerPeak,
206+ // $workerMemory,
207+ // $masterPeak
208+ // ));
206209
207210 $ offset += $ batchSize ;
208211 }
@@ -214,7 +217,6 @@ public function execute(InputInterface $input, OutputInterface $output): int
214217 // Old flow for CMS, CATEGORY and BRANDS
215218 $ feedService = $ this ->feedFactory ->create ($ context , $ entityClass );
216219 $ out = $ needFile ? new CsvFile ($ this ->file ) : new ConsoleOutput ($ output );
217-
218220 $ feedService ->generate ($ out , $ feedColumns );
219221 }
220222
@@ -228,13 +230,13 @@ public function execute(InputInterface $input, OutputInterface $output): int
228230 $ this ->pushImportService ->execute ();
229231 }
230232
231- // if (!$saveFile && $this->file) {
232- // $metaData = stream_get_meta_data($this->file);
233- //
234- // if (file_exists($metaData['uri'])) {
235- // unlink($metaData['uri']);
236- // }
237- // }
233+ if (!$ saveFile && $ this ->file ) {
234+ $ metaData = stream_get_meta_data ($ this ->file );
235+
236+ if (file_exists ($ metaData ['uri ' ])) {
237+ unlink ($ metaData ['uri ' ]);
238+ }
239+ }
238240
239241 return Command::SUCCESS ;
240242 }
@@ -293,7 +295,7 @@ private function getExportedEntityClass(string $exportType): string
293295 */
294296 private function createFile (string $ exportType , string $ salesChannelId )
295297 {
296- $ dir = $ this ->kernelProjectDir . '/var/factfinder/newflow ' ;
298+ $ dir = $ this ->kernelProjectDir . '/var/factfinder ' ;
297299
298300 if (!is_dir ($ dir )) {
299301 mkdir ($ dir );
0 commit comments