public function deregisterOnWorkerExit(WorkerInterface $worker)
    {
        $process = $worker->getProcess();
        $process->wait();
        if ($process->isCleanExit()) {
            $this->registry->deregister($worker);
        } else {
            throw new ResqueRuntimeException(
                sprintf(
                    'Foreman error with worker %s wait on pid %d',
                    $worker->getId(),
                    $process->getPid()
                )
            );
        }
    }