increase speed

This commit is contained in:
Marko
2024-03-20 17:32:52 +01:00
parent 060b481319
commit df4d62bfdf
15 changed files with 1907 additions and 777 deletions

View File

@@ -8,6 +8,8 @@ use App\Repository\ProductRepository;
use App\Repository\StockRepository;
use App\Repository\WarehouseRepository;
use Psr\Log\LoggerInterface;
use Sentry\CheckIn;
use Sentry\CheckInStatus;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
@@ -15,6 +17,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\HttpKernel\KernelInterface;
use function Sentry\captureCheckIn;
#[AsCommand(
name: 'hiltes:import',
@@ -49,6 +52,18 @@ class HiltesImportCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$time_start = microtime(true);
// 🟡 Notify Sentry your job is running:
$checkInId = captureCheckIn(
slug: 'bestandsabgleich-delta',
status: CheckInStatus::inProgress()
);
$this->logger->error('Start Hiltes Import');
dump($checkInId);
$io = new SymfonyStyle($input, $output);
$io->success('Start Hiltes Import');
@@ -65,6 +80,14 @@ class HiltesImportCommand extends Command
if (isset($r['error'])) {
$io->error($r['text']);
$this->logger->error($r['text']);
// 🔴 Notify Sentry your job has failed:
captureCheckIn(
slug: 'bestandsabgleich-delta',
status: CheckInStatus::error(),
checkInId: $checkInId,
);
return Command::FAILURE;
} else {
$io->info('Start Hiltes Push JTL');
@@ -81,6 +104,14 @@ class HiltesImportCommand extends Command
$execution_time = ($time_end - $time_start) / 60;
// 🟢 Notify Sentry your job has completed successfully:
captureCheckIn(
slug: 'bestandsabgleich-delta',
status: CheckInStatus::ok(),
duration: $execution_time,
checkInId: $checkInId
);
$io->success('Done.' . PHP_EOL . 'Execution time: ' . $execution_time . ' minutes');
return Command::SUCCESS;
}