report article numbers before we regen the article
authorTony Cook <tony@develop-help.com>
Thu, 27 Feb 2014 22:45:54 +0000 (09:45 +1100)
committerTony Cook <tony@develop-help.com>
Thu, 27 Feb 2014 22:45:54 +0000 (09:45 +1100)
This means we're reporting some percentage of progress before we've
made that progress (eg. a 1 article site would report 100% done before
regenning that article), but in practice the error is minimal, and
reporting the article id earlier makes it easier to diagnose regen
bugs.

site/cgi-bin/modules/BSE/Regen.pm

index 15fd6b7c01f246df9145c1f4e6e2856c3c437056..5be1ad5a0d574d9da5d7391474d800df2f9ab648 100644 (file)
@@ -10,7 +10,7 @@ use Carp qw(confess);
 use BSE::WebUtil qw(refresh_to_admin);
 use BSE::Util::HTML;
 
-our $VERSION = "1.011";
+our $VERSION = "1.012";
 
 # returns non-zero if the Regenerate button should work
 sub generate_button {
@@ -424,16 +424,16 @@ sub generate_all {
   for my $articleid (@articleids) {
     my $article = $articles->getByPkey($articleid);
     ++$index;
-    if ($article->{link} && $article->{template}) {
-      #$callback->("Article $articleid");
-      generate_low($articles, $article, $cfg);
-    }
     my $newpc = $index / @articleids * 100;
     my $now = time;
     if ($callback && $newpc >= $pc + 1 || abs($newpc-100) < 0.01) {
       $callback->(sprintf("%5d:  %.1f%% done - elapsed: %.1f", $articleid, $newpc, $now - $allstart)) if $callback;
       $pc = int $newpc;
     }
+    if ($article->{link} && $article->{template}) {
+      #$callback->("Article $articleid");
+      generate_low($articles, $article, $cfg);
+    }
   }
 
   my $last_section = "";