NAME
Loop::Sustainable::Strategy::ByLoad - Calculates wait interval by load.
SYNOPSIS
use
Loop::Sustainable;
loop_sustainable {
my
(
$i
,
$time_sum
) =
@_
;
#### maybe heavy process
} (
sub
{
my
(
$i
,
$time_sum
,
$rv
) =
@_
;
not
defined
$rv
->[0] ? 1 : 0;
},
{
strategy
=> {
class
=>
'ByLoad'
,
args
=> {
load
=> 0.5 },
}
}
);
DESCRIPTION
Loop::Sustainable::Strategy::ByLoad provides wait interval time calculated by total execution time and loop execution count, specified load ratio.
METHODS
new( %args )
wait_correction( $query, $time_sum, $executed_count )
AUTHOR
Toru Yamaguchi <zigorou@dena.jp<gt>
LICENSE
This module is licensed under the same terms as Perl itself.