Index: branches/release-29/lib/MT/Worker/Publish.pm
===================================================================
--- branches/release-29/lib/MT/Worker/Publish.pm (revision 1174)
+++ branches/release-29/lib/MT/Worker/Publish.pm (revision 1343)
@@ -24,10 +24,13 @@
     # and process them in one pass.
 
-    my @jobs;
-    push @jobs, $job;
+    my @jobs = ($job);
+    my $job_iter;
     if (my $key = $job->coalesce) {
-        while (my $job = MT::TheSchwartz->instance->find_job_with_coalescing_value($class, $key)) {
-            push @jobs, $job;
-        }
+        $job_iter = sub {
+            shift @jobs || MT::TheSchwartz->instance->find_job_with_coalescing_value($class, $key);
+        };
+    }
+    else {
+        $job_iter = sub { shift @jobs };
     }
 
@@ -40,5 +43,5 @@
     my $rebuilt = 0;
 
-    foreach $job (@jobs) {
+    while (my $job = $job_iter->()) {
         my $fi_id = $job->uniqkey;
         my $fi = MT::FileInfo->load($fi_id);
