--- job_queue.module       2007-08-02 13:09:55.000000000 -0700
+++ job_queue.module    2007-09-03 19:47:55.000000000 -0700
@@ -74,10 +76,12 @@ function job_queue_dequeue() {
 }
 
 function job_queue_cron() {
-  while (job_queue_dequeue()) {
+  $jobs = db_result(db_query('SELECT count(*) FROM {job_queue}'));
+  while ($processed != $jobs && job_queue_dequeue()) {
     if ((timer_read('page') / 1000) > (ini_get('max_execution_time') / 2)) {
-      break; // Stop once we have used over half of the maximum execution time.
+      break; // Stop once we have used over half of the maximum execution time or exceeds the original number of jobs.
     }
+    $processed++;
   }
 }