private function pickQueueByWight(array $queues)
    {
        $weights = array_map(function(QueueInterface $queue) {
            return $queue->getWeight();
        }, $queues);

        $rand = mt_rand(1, array_sum($weights));

        /** @var QueueInterface $queue */
        foreach ($queues as $queue) {
            $rand -= $queue->getWeight();
            if ($rand <= 0) {
                return $queue;
            }
        }
    }