function run()
    {
        $now = new DateTime('now');

        $sleep = min(array_map(
            function($entry) use ($now) {
                list($expression, $job) = $entry;

                return $expression->getNextRunDate($now)->getTimestamp();
            },
            $this->entries
        ));

        time_sleep_until($sleep);

        $scheduled = 0;

        foreach ($this->entries as $entry) {
            list($expression, $job) = $entry;

            if ($expression->isDue($now)) {
                $this->queue->push($job);
                $scheduled += 1;
            }
        }

        $this->queue->flush();

        return $scheduled;
    }