* Add a job to the queue. * * @param Job $job * @return string The job ID */
(Job $job)
| 211 | * @return string The job ID |
| 212 | */ |
| 213 | public function addJob(Job $job): string |
| 214 | { |
| 215 | $result = null; |
| 216 | |
| 217 | if ($job->opts->delay > 0) { |
| 218 | $result = $this->addDelayedJob($job, $job->opts->delay); |
| 219 | } elseif ($job->opts->priority !== null && $job->opts->priority > 0) { |
| 220 | $result = $this->addPrioritizedJob($job, $job->opts->priority); |
| 221 | } else { |
| 222 | $result = $this->addStandardJob($job, $job->timestamp); |
| 223 | } |
| 224 | |
| 225 | if (is_int($result) && $result < 0) { |
| 226 | throw $this->finishedErrors([ |
| 227 | 'code' => $result, |
| 228 | 'parentKey' => $job->parentKey, |
| 229 | 'command' => 'addJob', |
| 230 | ]); |
| 231 | } |
| 232 | |
| 233 | return (string) $result; |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Add a standard job to the queue. |
nothing calls this directly
no test coverage detected