src/Viper/Daemon/QueueRouter.php
public function pop(int $num) : Collection
    {
        $ret = new Collection();
        foreach ($this -> iterator as $item) {
            if (!$num--)
                return $ret;
            $ret[] = unserialize(file_get_contents($item));
            unlink($item);
        }
        $this -> updateIterator();
        return $ret;
    }
public function pop(int $num) : Collection
    {
        $ret = new Collection();
        foreach ($this -> iterator as $item) {
            if (!$num--)
                return $ret;
            $ret[] = unserialize(file_get_contents($item));
            unlink($item);
        }
        $this -> updateIterator();
        return $ret;
    }
public function pop ( int $ num ) : Collection { $ ret = new Collection ( ) ; foreach ( $ this -> iterator as $ item ) { if ( ! $ num -- ) return $ ret ; $ ret [ ] = unserialize ( file_get_contents ( $ item ) ) ; unlink ( $ item ) ; } $ this -> updateIterator ( ) ; return $ ret ; }
Get the oldest items from the queue
@param int $num the number of items to pop
@return Collection
TODO fix situation when crash is immediately after pop;
Get the oldest items from the queue