Show
Ignore:
Timestamp:
08/16/05 19:11:32 (4 years ago)
Author:
bradfitz
Message:

add in the whole "sorryTooSlow" XML element

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Perlbal/Plugin/AtomStream.pm

    r407 r408  
    1111our @subs;  # subscribers 
    1212 
     13use constant MAX_LAG => 262144; 
     14 
    1315sub InjectFeed { 
    1416    my $class = shift; 
     
    2123            next; 
    2224        } 
    23         $s->write($atomref); 
     25 
     26        my $lag = $s->{write_buf_size}; 
     27 
     28        if ($lag > MAX_LAG) { 
     29            $s->{scratch}{skipped_atom}++; 
     30        } else { 
     31            if (my $skip_count = $s->{scratch}{skipped_atom}) { 
     32                $s->{scratch}{skipped_atom} = 0; 
     33                $s->write(\ "<sorryTooSlow youMissed=\"$skip_count\" />\n"); 
     34            } 
     35            $s->write($atomref); 
     36        } 
    2437    } 
    2538