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

Method addJobArgs

php/src/Scripts.php:177–205  ·  view source on GitHub ↗

* Build the arguments for adding a job. * * @param Job $job * @return array */

(Job $job)

Source from the content-addressed store, hash-verified

175 * @return array<mixed>
176 */
177 public function addJobArgs(Job $job): array
178 {
179 $jsonData = json_encode($job->data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
180 $packedOpts = $this->packer->pack($job->opts->toArray());
181
182 $parent = $job->parent;
183 $parentKey = $job->parentKey;
184
185 // Build deduplication key if deduplication ID exists
186 $deduplicationKey = null;
187 $deduplication = $job->opts->deduplication;
188 if ($deduplication !== null && isset($deduplication['id']) && $deduplication['id'] !== '') {
189 $deduplicationKey = $this->keys[''] . 'de:' . $deduplication['id'];
190 }
191
192 $packedArgs = $this->packer->pack([
193 $this->keys[''],
194 $job->id ?? '',
195 $job->name,
196 $job->timestamp,
197 $job->parentKey,
198 $parentKey !== null ? "{$parentKey}:dependencies" : null,
199 $parent,
200 null, // repeatJobKey (not yet supported in PHP)
201 $deduplicationKey,
202 ]);
203
204 return [$packedArgs, $jsonData, $packedOpts];
205 }
206
207 /**
208 * Add a job to the queue.

Callers 6

addStandardJobMethod · 0.95
addDelayedJobMethod · 0.95
addPrioritizedJobMethod · 0.95

Calls 1

toArrayMethod · 0.80

Tested by

no test coverage detected