MCPcopy Create free account
hub / github.com/taskforcesh/bullmq / addJob

Method addJob

php/src/Scripts.php:213–234  ·  view source on GitHub ↗

* Add a job to the queue. * * @param Job $job * @return string The job ID */

(Job $job)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 4

addDelayedJobMethod · 0.95
addPrioritizedJobMethod · 0.95
addStandardJobMethod · 0.95
finishedErrorsMethod · 0.95

Tested by

no test coverage detected