Skip to content

Commit

Permalink
Add MongoQueue::count() back in. This has the chance of causing conte…
Browse files Browse the repository at this point in the history
…ntion on high load queues, but it's still a good utility method to have around.
  • Loading branch information
lunaru committed Aug 17, 2011
1 parent a00c50b commit 7fcf167
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/MongoQueue.php
Expand Up @@ -66,6 +66,14 @@ public static function hasRunnable($class_name = null, $method_name = null)
return ($collection->findOne($query) != null);
}

public static function count()
{
$collction = self::getCollection();

$query = array('when' => array('$lte' => time()), 'locked' => null);
return $collection->count($query);
}

public static function run($class_name = null, $method_name = null)
{
$db = self::getDatabase();
Expand Down

0 comments on commit 7fcf167

Please sign in to comment.