create queue if it not exists.
@param int $priority
@return ShmMap
@throws \RuntimeException
486294
protected function createQueue($priority)
    {
        if (!$this->queues[$priority]) {
            $config = $this->getOptions();
            $config['key'] = $this->intChannels[$priority];
            $this->queues[$priority] = new ShmMap($config);
        }

        return $this->queues[$priority];
    }
655507
public function setPriority($priority)
	{
		if (is_string($priority))
		{
			switch (strtolower($priority))
			{
				case 'high':
					$priority = 1;
					break;

				case 'normal':
					$priority = 3;
					break;

				case 'low':
					$priority = 5;
					break;

				default:
					$priority = 3;
					break;
			}
		}
		return parent::setPriority($priority);
	}
1055670
public function insert($datum, $priority) {
        if (is_int($priority)) {
            $priority = [$priority, $this->queueOrder--];
        }

        parent::insert($datum, $priority);
    }
1128852
public function setPriority($priority)
    {
        if (!$priority instanceof Priority) {
            $priority = new Priority(floatval($priority));
        }
        $this->elements[self::ELEMENT_PRIORITY] = $priority;

        return $this;
    }
869807
public function setup( $priority = 100 ) {

		if ( did_action( self::ACTION_SETUP ) ) {
			return $this;
		}

		// We use WONOLOG_DISABLE instead of WONOLOG_ENABLE so that not defined (default) means enabled.
		$disable_by_env = filter_var( getenv( 'WONOLOG_DISABLE' ), FILTER_VALIDATE_BOOLEAN );

		/**
		 * Filters whether to completely disable Wonolog.
		 *
		 * @param bool $disable
		 */
		if ( apply_filters( self::FILTER_DISABLE, $disable_by_env ) ) {
			return $this;
		}

		/**
		 * Fires right before Wonolog is set up.
		 */
		do_action( self::ACTION_SETUP );

		$processor_registry = new ProcessorsRegistry();
		$handlers_registry  = new HandlersRegistry( $processor_registry );
		$subscriber         = new LogActionSubscriber( new Channels( $handlers_registry, $processor_registry ) );
		$listener           = [ $subscriber, 'listen' ];

		add_action( LOG, $listener, $priority, PHP_INT_MAX );

		foreach ( Logger::getLevels() as $level => $level_code ) {
			// $level_code is from 100 (DEBUG) to 600 (EMERGENCY) this makes hook priority based on level priority
			add_action( LOG . '.' . strtolower( $level ), $listener, $priority + ( 601 - $level_code ), PHP_INT_MAX );
		}

		add_action( 'muplugins_loaded', [ HookListenersRegistry::class, 'initialize' ], PHP_INT_MAX );

		/**
		 * Fires right after Wonolog has been set up.
		 */
		do_action( self::ACTION_LOADED );

		return $this;
	}
328016
public function reserve(string $queue): ?Job
    {
        $item = $this->client->lpop(sprintf('queue:%s', $queue));

        if (!$item) {
            return null;
        }

        $payload = json_decode($item, true);

        $id = $payload['id'] ?? null;

        return new Job($payload['class'], $queue, $payload['args'], $id);
    }
696068
protected function createPriorityQueue()
    {
        $paths = $this->renderer->getPaths();

        if (!($paths instanceof PriorityQueue)) {
            $paths = new PriorityQueue($paths);

            $this->renderer->setPaths($paths);
        }

        return $this;
    }
926792
public function createRuntimeClient($path)
    {
        $kernel = RuntimeKernel::getKernel();

        return new Protocol1RuntimeClient(
            $kernel->getProtocol1RuntimeGoalStateClient(),
            $kernel->getProtocol1RuntimeCurrentStateClient(),
            $path
        );
    }
1289740
public function setPriority(int $priority): void
    {
        if ($priority < 0 || $priority > static::MAX_PRIORITY) {
            throw new \InvalidArgumentException('Priority must be an unsigned integer on the range [0-65535]');
        }

        $this->priority = $priority;
    }
866771
public static function factory( $type = 'custom', $priority = 1000 ) {
		$class = self::verify_class_name( __CLASS__ . '_' . $type, 'Unexisting breadcrumb item type: "' . $type . '".' );

		$item = new $class( $priority );
		$item->set_type( $type );

		return $item;
	}
882627
public function priority($priority, $retryTimeout = null, $expireAfter = null)
    {
        $this->noEmergencyWithoutRetryOrExpire($priority, $retryTimeout, $expireAfter);

        $this->priority = $priority;
        $this->retry = $retryTimeout;
        $this->expire = $expireAfter;

        return $this;
    }
1239664
public function compare($priority1, $priority2)
    {
        if (!$priority1 instanceof EventQueuePriority || !$priority2 instanceof EventQueuePriority) {
            return parent::compare($priority1, $priority2);
        }

        $priority = $priority1->value - $priority2->value;
        if (!$priority) {
            $priority = $priority2->timestamp - $priority1->timestamp;
        }
        return $priority;
    }
334674
public function add($process): Runnable
    {
        if (! is_callable($process) && ! $process instanceof Runnable) {
            throw new InvalidArgumentException('The process passed to Pool::add should be callable.');
        }

        if (! $process instanceof Runnable) {
            $process = ParentRuntime::createProcess($process);
        }

        $this->putInQueue($process);

        return $process;
    }
337321
public function priority($priority = null) {
		if ($priority === null) {
			return $this->_priority;
		}
		$this->_priority = $priority;
		return $this;
	}
266498
public function addGlobalPath($path, $priority = PriorityQueue::LOW)
    {
        $this->getPaths()->insert($path, $priority);

        return $this;
    }
592191
function createPriority() {
    $cnt = count( $this->priority );
    if( 0 >= $cnt )
      return;
    $attributes = $this->_createParams( $this->priority['params'] );
    return $this->_createElement( 'PRIORITY', $attributes, $this->priority['value'] );
  }
1333233
public function addPath($path, $priority = PriorityQueue::NORMAL)
    {
        $this->renderer->addPath($path, $priority);

        return $this;
    }