From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

Loop::Sustainable::Strategy::ByLoad - Calculates wait interval by load.

SYNOPSIS

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 )

load

The ratio of executed time.

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.

SEE ALSO

Loop::Sustainable