* Obliterate (completely destroy) the queue. * * @param int $count Maximum number of jobs to remove per iteration * @param bool $force Force obliteration even with active jobs * @return int Cursor position, 0 when complete */
(int $count, bool $force = false)
| 455 | * @return int Cursor position, 0 when complete |
| 456 | */ |
| 457 | public function obliterate(int $count, bool $force = false): int |
| 458 | { |
| 459 | $keys = $this->getKeys(['meta', '']); |
| 460 | $result = $this->execScript('obliterate-2.lua', $keys, [$count, $force ? 1 : '']); |
| 461 | |
| 462 | if (is_int($result) && $result < 0) { |
| 463 | if ($result === -1) { |
| 464 | throw new \RuntimeException('Cannot obliterate non-paused queue'); |
| 465 | } |
| 466 | if ($result === -2) { |
| 467 | throw new \RuntimeException('Cannot obliterate queue with active jobs'); |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | return (int) $result; |
| 472 | } |
| 473 | |
| 474 | /** |
| 475 | * Move jobs to wait state (for retrying). |
nothing calls this directly
no test coverage detected