Scalr\System\Zmq\Cron\Task\ImagesBuilder::enqueue PHP Method

enqueue() public method

See also: Scalr\System\Zmq\Cron\TaskInterface::enqueue()
public enqueue ( )
    public function enqueue()
    {
        $queue = new ArrayObject([]);
        $db = \Scalr::getDb();
        $rs = $db->Execute("SELECT id FROM bundle_tasks WHERE status NOT IN (?,?,?)", array(SERVER_SNAPSHOT_CREATION_STATUS::SUCCESS, SERVER_SNAPSHOT_CREATION_STATUS::FAILED, SERVER_SNAPSHOT_CREATION_STATUS::CANCELLED));
        while ($rec = $rs->FetchRow()) {
            $obj = new stdClass();
            $obj->bundleTaskId = $rec['id'];
            $queue->append($obj);
        }
        if ($cnt = count($queue)) {
            $this->getLogger()->info("%d bundle tasks found", $cnt);
        } else {
            $this->getLogger()->info("No bundle tasks.");
        }
        return $queue;
    }