Conditions | 4 |
Paths | 8 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | public function run($request): void // phpcs:ignore SlevomatCodingStandard.TypeHints |
||
41 | { |
||
42 | echo '<p>Pass GET param ?total=x to create x jobs.</p>'; |
||
43 | echo '<p>Pass GET param ?type=(2|3) to create jobs in medium|large queues respectively' |
||
44 | . ' (defaults to large).</p>'; |
||
45 | |||
46 | $total = $request->getVar('total') ?: 0; |
||
47 | $type = $request->getVar('type') ?: QueuedJob::LARGE; |
||
48 | $service = QueuedJobService::singleton(); |
||
49 | |||
50 | for ($i = 1; $i <= $total; $i += 1) { |
||
51 | $randomId = $i . DBDatetime::now()->getTimestamp(); |
||
52 | $job = new Job(); |
||
53 | $job->hydrate((int) $type, (int) $randomId); |
||
54 | $service->queueJob($job); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 |