refactor(redis, discovery, cache): streamline configuration defaults, logging, and error handling
- Remove default values for `RedisConfig` constructor to enforce explicit configuration. - Enhance `FileStreamProcessor` logging by adding `LogContext` with exception details. - Replace `humanReadable` method call with `toHumanReadable` in `DiscoveryCompletedEvent`. - Remove redundant error trace logging in `CacheInitializer` for cleaner fallback handling.
This commit is contained in:
@@ -20,15 +20,14 @@ final readonly class DiscoveryCompletedEvent
|
||||
public ?ScannerMetrics $metrics,
|
||||
public ScanType $scanType,
|
||||
public Timestamp $timestamp
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'files_scanned' => $this->filesScanned,
|
||||
'duration_seconds' => $this->duration->toSeconds(),
|
||||
'duration_human' => $this->duration->humanReadable(),
|
||||
'duration_human' => $this->duration->toHumanReadable(),
|
||||
'metrics' => $this->metrics?->toArray(),
|
||||
'scan_type' => $this->scanType->value,
|
||||
'timestamp' => $this->timestamp->toFloat(),
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Framework\Filesystem\ValueObjects\FilePath;
|
||||
use App\Framework\Filesystem\FileScanner;
|
||||
use App\Framework\Filesystem\ValueObjects\FilePattern;
|
||||
use App\Framework\Logging\Logger;
|
||||
use App\Framework\Logging\ValueObjects\LogContext;
|
||||
use Generator;
|
||||
|
||||
/**
|
||||
@@ -68,7 +69,8 @@ final readonly class FileStreamProcessor
|
||||
} catch (\Throwable $e) {
|
||||
// Only log errors, not every processed file
|
||||
$this->logger?->warning(
|
||||
"Failed to process file {$file->getPath()->toString()}: {$e->getMessage()} in FileStreamProcessor"
|
||||
"Failed to process file {$file->getPath()->toString()}: {$e->getMessage()} in FileStreamProcessor",
|
||||
LogContext::withException($e)
|
||||
);
|
||||
} finally {
|
||||
// Always cleanup after processing a file
|
||||
|
||||
Reference in New Issue
Block a user