Lines
0.00%
0 / 14
Methods
0.00%
0 / 3
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| handledMessageClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| handle | 0.00% | 0 / 12 | 0.00% | 0 / 1 | 2 | ||
| 16 | final readonly class WorkerReadyHandler implements WorkerMessageHandler | |
| 17 | { | |
| 18 | public function __construct( | |
| 19 | private WorkerPool $pool, | |
| 20 | private ExposureReconciler $reconciler, | |
| 21 | private LoggerInterface $logger, | |
| 22 | ) {} | |
| 23 | ||
| 24 | public function handledMessageClass(): string | |
| 25 | { | |
| 26 | return WorkerReady::class; | |
| 27 | } | |
| 28 | ||
| 29 | /** @param WorkerReady $message */ | |
| 30 | public function handle(WorkerHandle $handle, WorkerMessage $message): void | |
| 31 | { | |
| 32 | $this->pool->markReady($handle); | |
| 33 | $this->reconciler->recordWorkerReady( | |
| 34 | $handle->id, | |
| 35 | $message->appIds->collection->filter(static fn(AppId $appId): bool => !$message->failedAppIds->collection->containsId($appId)), | |
| 36 | ); | |
| 37 | ||
| 38 | $this->logger->info('Worker ready', [ | |
| 39 | 'worker' => $handle->id->value, | |
| 40 | 'pid' => $handle->getPid(), | |
| 41 | 'apps' => $message->appIds->collection->toStrings(), | |
| 42 | 'failed' => $message->failedAppIds->collection->toStrings(), | |
| 43 | 'memory_mb' => round($message->memoryBytes / 1048576, 1), | |
| 44 | ]); | |
| 45 | } | |
| 46 | } |