Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
web: limit tables to 100000 rows
Avoid killing the browser
  • Loading branch information
donald committed Jan 3, 2017
1 parent 2e4302d commit 6ab5d3b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion web/pages/mxq/mxq.in
Expand Up @@ -13,6 +13,8 @@ our $dbh;
our $hostconfig;
our $q;

our $LIMIT=100000; # max rows

sub STYLE {
return <<'EOF';
<style>
Expand Down Expand Up @@ -233,6 +235,7 @@ sub job_table_pending {

$out.=$q->Tr($q->th(\@cols));

my $cnt=0;
while (my $row=$sth->fetchrow_arrayref()) {
my ($job_id,$user_name,$date_submit,$job_threads)=@$row;

Expand All @@ -242,8 +245,12 @@ sub job_table_pending {
$q->td($date_submit),
$q->td({class=>'number'},$job_threads),
);
++$cnt == $LIMIT and last;
}
$out.='</table>';
if ($cnt==$LIMIT) {
$out.=$q->p($q->em("(truncated after $LIMIT rows)"));
}
}

sub job_table_running {
Expand Down Expand Up @@ -313,7 +320,7 @@ __EOF__

my $lds;
my $col=1;

my $cnt=0;
while (my $row=$sth->fetchrow_arrayref()) {
my ($job_id,$job_status,$date_submit,$date_start,$date_end,$host_hostname,$host_pid,
$qtime,$qtime_now,$rtime,$rtime_now,$ds)=@$row;
Expand Down Expand Up @@ -346,8 +353,12 @@ __EOF__
$q->td($host_hostname),
$q->td({class=>'number'},$host_pid),
);
++$cnt == $LIMIT and last;
}
$out.='</table>';
if ($cnt==$LIMIT) {
$out.=$q->p($q->em("(truncated after $LIMIT rows)"));
}
}

sub job_status_filter_buttons {
Expand Down

0 comments on commit 6ab5d3b

Please sign in to comment.