Author: sparky
Date: Sun Nov 22 23:24:51 2009
New Revision: 10997

Modified:
   toys/stbr/queue_parser.pl
Log:
- print partial info 8 minutes after first received status


Modified: toys/stbr/queue_parser.pl
==============================================================================
--- toys/stbr/queue_parser.pl   (original)
+++ toys/stbr/queue_parser.pl   Sun Nov 22 23:24:51 2009
@@ -127,8 +127,8 @@
        foreach my $p ( @pkg ) {
                my ($id) = $p =~ m{<batch id='(.*?)'};
 
-               if ( $data->{printed}->{$id} ) {
-                       $printed{$id} = 1;
+               if ( ( $data->{printed}->{$id} or "" ) eq "all" ) {
+                       $printed{$id} = "all";
                        next;
                }
 
@@ -160,27 +160,42 @@
                        }
                }
 
-               my $print = undef;
                if ( $all_done ) {
-                       $print = 1;
-               } elsif ( $some_done ) {
-                       $print = 0 if $time + 120 < $now;
-               }
-               if ( not $all_done ) {
+                       # all done
+                       next if $printed_something > 4;
+                       $printed{$id} = "all";
+               } else {
                        $done_so_far = 0;
-                       $printed{$id} = 0 if $some_done;
-                       next if exists $data->{printed}->{$id};
-               }
+                       next unless $some_done;
 
-               if ( defined $print ) {
-                       $printed{$id} = $print;
+                       # some done ?
+                       my $ftime = $data->{printed}->{$id};
+                       if ( $ftime and $ftime eq "some" ) {
+                               $printed{$id} = "some";
+                               next;
+                       }
 
-                       print $pre
-                               . "$rpm$color_b:$color_e "
-                               . ( join ", ", @status )
-                               . "\n";
-                       last GROUP if not $term and ++$printed_something > 4;
+                       # nothing printed yet, first status info
+                       unless ( $ftime ) {
+                               $printed{$id} = $now;
+                               next;
+                       }
+                       $printed{$id} = $ftime;
+
+                       next unless $ftime =~ /^\d+$/; # bug
+                       next if $printed_something > 4;
+                       if ( $ftime + 8 * 60 < $now ) {
+                               $printed{$id} = "some";
+                       } else {
+                               next;
+                       }
                }
+
+               print $pre
+                       . "$rpm$color_b:$color_e "
+                       . ( join ", ", @status )
+                       . "\n";
+               $printed_something++ unless $term;
        }
        $data->{last_time} = $time if $done_so_far;
 }
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to