protected function finishJob(Job $job, bool $internal): void
    {
        if ($this->logger) {
            $this->logger->info('Finished a job.', [
                'name' => $job->getName(),
                'arguments' => $job->getArguments(),
            ]);
        }
        if ($this->eventDispatcher) {
            $this->eventDispatcher->dispatch(self::JOB_FINISHED_EVENT, new FinishedJobEvent($job, $internal));
        }
        if ($this->triggerBatchEvents) {
            $this->finishBatch(new JobBatch([], [$job]));
        }
    }