src/Jobs/Reservers/PriorityReserver.php
public function beforeWork(): void
    {
        parent::beforeWork();

        // Random for queues with equal priorities
        shuffle($this->queues);

        $priorities = $this->priorities;
        usort($this->queues, function (Queue $firstQueue, Queue $secondQueue) use ($priorities) {
            $priorityFirst = $priorities[(string) $firstQueue] ?? self::DEFAULT_PRIORITY;
            $prioritySecond = $priorities[(string) $secondQueue] ?? self::DEFAULT_PRIORITY;

            return $prioritySecond - $priorityFirst;
        });

        if (empty($this->queues) == false) {
            $this->logger->info(
                'Monitoring the following queues: {queues}',
                ['queues' => implode(', ', $this->queues)]
            );
        }
    }
public function beforeWork(): void
    {
        parent::beforeWork();

        // Random for queues with equal priorities
        shuffle($this->queues);

        $priorities = $this->priorities;
        usort($this->queues, function (Queue $firstQueue, Queue $secondQueue) use ($priorities) {
            $priorityFirst = $priorities[(string) $firstQueue] ?? self::DEFAULT_PRIORITY;
            $prioritySecond = $priorities[(string) $secondQueue] ?? self::DEFAULT_PRIORITY;

            return $prioritySecond - $priorityFirst;
        });

        if (empty($this->queues) == false) {
            $this->logger->info(
                'Monitoring the following queues: {queues}',
                ['queues' => implode(', ', $this->queues)]
            );
        }
    }
public function beforeWork ( ) : void { parent :: beforeWork ( ) ; // Random for queues with equal priorities shuffle ( $ this -> queues ) ; $ priorities = $ this -> priorities ; usort ( $ this -> queues , function ( Queue $ firstQueue , Queue $ secondQueue ) use ( $ priorities ) { $ priorityFirst = $ priorities [ ( string ) $ firstQueue ] ?? self :: DEFAULT_PRIORITY ; $ prioritySecond = $ priorities [ ( string ) $ secondQueue ] ?? self :: DEFAULT_PRIORITY ; return $ prioritySecond - $ priorityFirst ; } ) ; if ( empty ( $ this -> queues ) == false ) { $ this -> logger -> info ( 'Monitoring the following queues: {queues}' , [ 'queues' => implode ( ', ' , $ this -> queues ) ] ) ; } }
{@inheritdoc}

@return void
{ @inheritdoc }