Bug 41920: Move total_running_reports_per_instance_limit to Koha/Reports.pm
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
7ba7bbab7d
commit
ada73c317c
|
|
@ -14,6 +14,11 @@ use Exception::Class (
|
|||
description => "The configured per-user limit on total simultaneous report runs has been reached",
|
||||
fields => [ 'user_id', 'limit' ],
|
||||
},
|
||||
'Koha::Exceptions::Report::InstanceTotalRunning' => {
|
||||
isa => 'Koha::Exceptions::Report',
|
||||
description => "The configured instance-wide limit on total simultaneous report runs has been reached",
|
||||
fields => ['limit'],
|
||||
}
|
||||
);
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -283,6 +283,14 @@ sub prep_report {
|
|||
}
|
||||
}
|
||||
|
||||
my $instance_limit = C4::Context->config('total_running_reports_per_instance_limit');
|
||||
if ($instance_limit) {
|
||||
my $running = Koha::Reports->running();
|
||||
if ( $running->count >= $instance_limit ) {
|
||||
Koha::Exceptions::Report::InstanceTotalRunning->throw( limit => $instance_limit );
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " /* { saved_sql.id: $report_id } { user_id: $user_id } */";
|
||||
|
||||
return $sql, $headers;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ sub running {
|
|||
}
|
||||
|
||||
my $rs = $class->search( { id => { -in => [ keys %report_ids ] } } );
|
||||
return wantarray ? $rs->as_list : $rs;
|
||||
return $class->search( { id => { -in => [ keys %report_ids ] } } );
|
||||
}
|
||||
|
||||
=head3 _processlist_rows
|
||||
|
|
|
|||
Loading…
Reference in New Issue