2013-04-03 Koichiro KIKUCHI <koichiro@rworks.jp>
* pandora_agent: Adjust sleep interval so that each interval *starts* with the same interval. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7922 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a6afc9a0ad
commit
3525bac990
|
@ -1,3 +1,8 @@
|
||||||
|
2013-04-03 Koichiro KIKUCHI <koichiro@rworks.jp>
|
||||||
|
|
||||||
|
* pandora_agent: Adjust sleep interval so that each interval *starts*
|
||||||
|
with the same interval.
|
||||||
|
|
||||||
2013-03-12 Ramon Novoa <rnovoa@artica.es>
|
2013-03-12 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* pandora_revent: Added to repository. Pandora remote event generation
|
* pandora_revent: Added to repository. Pandora remote event generation
|
||||||
|
|
|
@ -1578,7 +1578,7 @@ sub check_module_cron ($) {
|
||||||
return 1 unless ($module->{'cron'} ne '');
|
return 1 unless ($module->{'cron'} ne '');
|
||||||
|
|
||||||
# Check if the module was already executed
|
# Check if the module was already executed
|
||||||
return 0 unless (time() > $module->{'cron_utimestamp'});
|
return 0 unless (time() >= $module->{'cron_utimestamp'});
|
||||||
|
|
||||||
# Get cron configuration
|
# Get cron configuration
|
||||||
my @cron_params = split (/\s/, $module->{'cron'});
|
my @cron_params = split (/\s/, $module->{'cron'});
|
||||||
|
@ -1932,6 +1932,9 @@ if ($Conf{'udp_server'} == 1){
|
||||||
# Must be set to 0 if the agent is a broker agent
|
# Must be set to 0 if the agent is a broker agent
|
||||||
my $main_agent = -1;
|
my $main_agent = -1;
|
||||||
|
|
||||||
|
# base time to start eatch iteration with the same interval.
|
||||||
|
my $iter_base_time = time();
|
||||||
|
|
||||||
# Loop
|
# Loop
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
@ -2159,7 +2162,17 @@ while (1) {
|
||||||
# Cron mode
|
# Cron mode
|
||||||
last if ($Conf{'cron_mode'} == 1);
|
last if ($Conf{'cron_mode'} == 1);
|
||||||
|
|
||||||
sleep ($Conf{'intensive_interval'});
|
$iter_base_time += $Conf{'intensive_interval'};
|
||||||
|
my $now = time();
|
||||||
|
|
||||||
|
my $interval_remain = $iter_base_time - $now;
|
||||||
|
|
||||||
|
if ($interval_remain >= 0) {
|
||||||
|
sleep ($interval_remain);
|
||||||
|
} else {
|
||||||
|
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||||
|
$iter_base_time = $now; # use current time as base time
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# Finish if broker agent
|
# Finish if broker agent
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue