Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
- Remove middleware reference from Gitea Traefik labels (caused routing issues) - Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s) - Add explicit service reference in Traefik labels - Fix intermittent 504 timeouts by improving PostgreSQL connection handling Fixes Gitea unreachability via git.michaelschiemer.de
96 lines
2.7 KiB
PHP
96 lines
2.7 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use App\Framework\CommandBus\CommandBus;
|
|
use App\Framework\Console\ConsoleOutput;
|
|
use App\Framework\Core\AppBootstrapper;
|
|
use App\Framework\Queue\FileQueue;
|
|
use App\Framework\Performance\EnhancedPerformanceCollector;
|
|
use App\Framework\DateTime\SystemClock;
|
|
use App\Framework\DateTime\SystemHighResolutionClock;
|
|
use App\Framework\Performance\MemoryMonitor;
|
|
use App\Framework\Queue\Queue;
|
|
use App\Framework\Worker\Worker;
|
|
use App\Framework\Pcntl\PcntlService;
|
|
use App\Framework\Pcntl\ValueObjects\Signal;
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
require __DIR__ . '/src/Framework/Debug/helpers.php';
|
|
|
|
// Create dependencies for enhanced performance collector
|
|
$clock = new SystemClock();
|
|
$highResClock = new SystemHighResolutionClock();
|
|
$memoryMonitor = new MemoryMonitor();
|
|
$collector = new EnhancedPerformanceCollector($clock, $highResClock, $memoryMonitor, enabled: false);
|
|
$bootstrapper = new AppBootstrapper(__DIR__, $collector, $memoryMonitor);
|
|
|
|
$container = $bootstrapper->bootstrapWorker();
|
|
|
|
$queue = $container->get(Queue::class);
|
|
|
|
$worker = new Worker(
|
|
$container,
|
|
$queue, #new FileQueue(__DIR__ . '/src/Framework/CommandBus/storage/queue/'),
|
|
$container->get(CommandBus::class),
|
|
$container->get(ConsoleOutput::class),
|
|
);
|
|
|
|
// Setup signal handlers using PCNTL service if available
|
|
try {
|
|
$pcntlService = $container->get(PcntlService::class);
|
|
$pcntlService->registerSignal(Signal::SIGTERM, function () use ($worker) {
|
|
$worker->stop();
|
|
});
|
|
$pcntlService->registerSignal(Signal::SIGINT, function () use ($worker) {
|
|
$worker->stop();
|
|
});
|
|
} catch (\Throwable $e) {
|
|
// Fallback to direct pcntl_signal if PCNTL service not available
|
|
if (function_exists('pcntl_signal')) {
|
|
pcntl_signal(SIGTERM, function () use ($worker) {
|
|
$worker->stop();
|
|
});
|
|
pcntl_signal(SIGINT, function () use ($worker) {
|
|
$worker->stop();
|
|
});
|
|
}
|
|
}
|
|
|
|
$worker->start();
|
|
|
|
|
|
|
|
/*
|
|
$queue = new FileQueue(__DIR__ . '/src/Framework/CommandBus/storage/queue/');
|
|
|
|
error_log('Worker started');
|
|
|
|
error_log(__DIR__ . '/src/Framework/CommandBus/storage/queue');
|
|
|
|
#$commandBus = $container->get(CommandBus::class);
|
|
|
|
#$commandBus->dispatch(new \App\Application\Newsletter\SignUp\SignupUserToNewsletter('Michael', 'mail'));
|
|
|
|
#var_dump($queue);
|
|
|
|
while (true) {
|
|
$job = $queue->pop();
|
|
|
|
if ($job) {
|
|
try {
|
|
// Job verarbeiten
|
|
|
|
#$commandBus->handle($job);
|
|
|
|
error_log('handled: ' . $job::class);
|
|
|
|
#(new JobProcessor())->handle($job);
|
|
} catch (\Throwable $e) {
|
|
// Fehler-Handling / Retry-Logik
|
|
}
|
|
} else {
|
|
// Leerlauf-Pause, z.B. 100 ms
|
|
usleep(100_000);
|
|
}
|
|
}*/
|