$statement->execute([ $row['jobID'] ]);
}
}
+
+ /**
+ * Returns how many items are due.
+ * Note: Do not rely on the return value being correct, some other process may
+ * have modified the queue contents, before this method returns. Think of it as an
+ * approximation to know whether you should spend some time to clear the queue.
+ *
+ * @return int
+ */
+ public function getRunnableCount() {
+ $sql = "SELECT COUNT(*)
+ FROM wcf".WCF_N."_background_job
+ WHERE status = ?
+ AND time <= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([ 'ready', TIME_NOW ]);
+
+ return $statement->fetchSingleColumn();
+ }
}